DCE Application Programming Guide

Sample Application Listings
HP NonStop DCE Application Programming Guide429551-003
A-8
The Client File
status = get_system_info(binding, /* (3) */ /* (b) */
&system_info);
if (status == rpc_s_ok)
{
printf("Directory Service Name = %s\n"
"System Name = %s\n"
"Node Name = %s\n"
"Release = %s\n"
"Version = %s\n"
"Machine Type = %s\n",
ptr_check (server_name_p),
ptr_check (system_info.sysname_p),
ptr_check (system_info.nodename_p),
ptr_check (system_info.release_p),
ptr_check (system_info.version_p),
ptr_check (system_info.machine_p));
non_null_free (system_info.sysname_p);
non_null_free (system_info.nodename_p);
non_null_free (system_info.release_p);
non_null_free (system_info.version_p);
non_null_free (system_info.machine_p);
}
else {
/* rpc to info server failed */ /* (c) */
fprintf(stderr,
"Error on RPC to Info Server on %s\n",
server_name_p);
WRN_CHK(status, "RPC error");
status = rpc_s_ok;
}
rpc_string_free( &server_name_p, /* (5) */
&status);
}
} /* End of while(1) */
if (status != rpc_s_no_more_bindings)
{
WRN_CHK(status, "Error importing next binding"); /* (d) */
}
rpc_ns_binding_import_done( &binding_context, /* (6) */
&status);
WRN_CHK(status,"Error releasing binding context");
return(1);
}
idl_char * ptr_check (idl_char * inp_p)
{
return (inp_p !=NULL ? inp_p : unknown_string);
}
void non_null_free (void * inp_p)
{
if (inp_p!=NULL)
{
free (inp_p);
}
}
Figure A-5. The Client File in a Straight Port (page 2 of 2)