#include #include "pow.h" int power( char *host, int x, int y ) { CLIENT *clnt; int *result_1; operands power_1_arg; /* create a client handle */ clnt = clnt_create(host, POWPROG, POWVERSION, "netpath"); if (clnt == (CLIENT *) NULL) { clnt_pcreateerror(host); exit(1); } /* collect the aruments */ power_1_arg.x = x; power_1_arg.y = y; result_1 = power_1(&power_1_arg, clnt); if (result_1 == (int *) NULL) { clnt_perror(clnt, "call failed"); } clnt_destroy(clnt); return(*result_1); } main( int argc, char *argv[]) { int x,y,res; char *host; if (argc!=4) { fprintf(stderr,"Usage: power host num topower\n"); exit(0); } host = argv[1]; x = atoi(argv[2]); y = atoi(argv[3]); res = power(host,x,y); printf("%d raised to the %d power is %d\n",x,y,res); return(0); }