/* * This is sample code generated by rpcgen. * These are only templates and you can use them * as a guideline for developing your own functions. */ #include "nameserver.h" #include #include /* getenv, exit */ void nameserver_1(char *host) { CLIENT *clnt; int *result_1; rpc_hostInfo register_1_arg; int *result_2; int unregister_1_arg; rpc_hostInfo *result_3; int find_1_arg; int *result_4; char * findname_1_arg; #ifndef DEBUG clnt = clnt_create(host, NAMESERVER, DATE_VERS, "netpath"); if (clnt == (CLIENT *) NULL) { clnt_pcreateerror(host); exit(1); } #endif /* DEBUG */ result_1 = register_1(®ister_1_arg, clnt); if (result_1 == (int *) NULL) { clnt_perror(clnt, "call failed"); } result_2 = unregister_1(&unregister_1_arg, clnt); if (result_2 == (int *) NULL) { clnt_perror(clnt, "call failed"); } result_3 = find_1(&find_1_arg, clnt); if (result_3 == (rpc_hostInfo *) NULL) { clnt_perror(clnt, "call failed"); } result_4 = findname_1(&findname_1_arg, clnt); if (result_4 == (int *) NULL) { clnt_perror(clnt, "call failed"); } #ifndef DEBUG clnt_destroy(clnt); #endif /* DEBUG */ } main(int argc, char *argv[]) { char *host; if (argc < 2) { printf("usage: %s server_host\n", argv[0]); exit(1); } host = argv[1]; nameserver_1(host); }