/* * 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 "math.h" void mathprog_1(char *host, int a1, int a2) { CLIENT *clnt; int *result_1; int *result_2; #ifndef DEBUG clnt = clnt_create(host, MATHPROG, MATHVERS, "netpath"); if (clnt == (CLIENT *) NULL) { clnt_pcreateerror(host); exit(1); } #endif /* DEBUG */ result_1 = sum_1(a1, a2, clnt); if (result_1 == (int *) NULL) { clnt_perror(clnt, "call failed"); } else { printf ("%d + %d = %d\n", a1, a2, *result_1); } result_2 = mult_1(a1, a2, clnt); if (result_2 == (int *) NULL) { clnt_perror(clnt, "call failed"); } else { printf ("%d * %d = %d\n", a1, a2, *result_2); } #ifndef DEBUG clnt_destroy(clnt); #endif /* DEBUG */ } main(int argc, char *argv[]) { char *host; int a1, a2; if (argc != 4) { printf("usage: %s server_host number number\n", argv[0]); exit(1); } host = argv[1]; sscanf (argv[2], "%d", &a1); sscanf (argv[3], "%d", &a2); mathprog_1(host, a1, a2); }