/* ** File name: GETSYI_CLNT_CALL.C ** ** Copyright (c) 1991, by ** Process Software Corporation ** Framingham, Massachusetts ** ** This file along with GETSYI_CLNT_SUBS.C and GETSYI_CLNT.C implement a ** client for the getsyi protocol. This particular client uses the RPC ** clnt_call function. ** */ /* ** Include files */ #include /* status code definitions (SS$_OPINCOMPL) */ #include "TCPWARE_INCLUDE:RPC.H" #include "GETSYI.H" /* created by RPCGEN */ #include "GETSYI_DEF.H" /* ** Declare Functions */ longw parse_command_line(); void write_output(); /* ** Variables ** ** The transport that the client will use to contact the server. Since the ** clnt_call RPC function may use either UDP or TCP, allow the user to specify ** it. This is done by initially setting transport to a null string. */ globaldef char transport[4] = {0, 0, 0, 0}; /* ** The name of the server's host. Again, an initial value of 0 allows the user ** to specify any host. */ globaldef char *host = 0; static readonly char usage[] = "Command format: getsyi [-u|-t] [-d#] [-hhost] [-nnode] code [code...]\n"; /* **************************************** ** ** Main program ** ** Abstract: ** This client program demonstrates the use of the clnt_call function. */ main( argc, argv) int argc; char *argv[]; { longw status; /* VMS status code */ getsyi_args args; /* request sent to server */ getsyi_res *resultsp; /* reply received from server */ CLIENT *clnt; /* client server handle */ /* ** Parse the command line that the user entered. After this function call, the ** variable transport is either "UDP" or "TCP". The variable host points to ** the name of the server's host. args contains all of the information that ** will be sent to the server. */ _error( status = parse_command_line( argc, argv, &args)) { if( status == SS$_BADPARAM) printf( usage); /* tell the user the correct format */ exit( status); } /* ** Create a client that uses the appropriate transport. */ clnt = clnt_create( host, GETSYI_PROG, GETSYI_VERS_1, transport); if( clnt == 0) { clnt_pcreateerror( "Unable to create client"); exit( SS$_OPINCOMPL); } /* ** Call the server with the code strings that the user supplied. ** ** This function is described in the file GETSYI_CLNT.C */ resultsp = getsyi_proc_1_1( &args, clnt); if( resultsp == 0) { clnt_perror( clnt, "Unable to call server"); exit( SS$_OPINCOMPL); } /* ** Display the output for the user to see, then free the memory that was used ** when converting the results to the VAX format. Finally, destroy the client. */ write_output( &args, resultsp); clnt_freeres( clnt, xdr_getsyi_res, resultsp); clnt_destroy( clnt); exit( SS$_NORMAL); } /* end file GETSYI_CLNT_CALL.C */