DCE Application Programming Guide

Sample Application Listings
HP NonStop DCE Application Programming Guide429551-003
A-7
The Client File
The Client File
The client file is shown in Figure A-5.
Figure A-5. The Client File in a Straight Port (page 1 of 2)
/* infpls_c.c */
/*
* (c) Copyright 1993 Harold W. Lockhart and Frederic M. Oldfield
* ALL RIGHTS RESERVED
*
* Permission is hereby granted to use, copy, modify and freely
* distribute this software for any purpose without fee, provided
* that the above copyright notice and this permission notice are
* retained in it.
*
* The authors make no representations about the suitability of
* this software for any purpose. It is provided "as is" without
* express or implied warranty. The authors assume no liability,
* direct or consequential, resulting from its use.
*/
#include <stdlib.h>
#include <stdio.h>
#include <dce/rpc.h>
#include "infpls.h"
#include "errmac.h"
/* This client calls each server which is a member of the Infopls Group */
/* getting the usname information from each one and printing it out */
static idl_char * ptr_check (idl_char *inp_p);
static void non_null_free (void *inp_p);
static idl_char unknown_string[]="-Unknown-";
main(int argc, char *argv[])
{
error_status_t status;
rpc_ns_handle_t binding_context;
rpc_binding_handle_t binding;
sys_info_t system_info;
unsigned_char_t *server_name_p;
rpc_ns_binding_import_begin( rpc_c_ns_syntax_default, /* (1) */
NULL,
infpls_v1_0_c_ifspec,
NULL,
&binding_context,
&status);
ERR_CHK(status,"Could not import binding context");
status=rpc_s_ok;
while (status==rpc_s_ok)
{
rpc_ns_binding_import_next( binding_context, /* (2) */
&binding,
&status);
if (status == rpc_s_ok)
{
rpc_ns_binding_inq_entry_name( binding, /* (4) */ /* (a) */
rpc_c_ns_syntax_default,
&server_name_p,
&status);
ERR_CHK(status,"Could not get binding entry name");