/* Taken from http://www2.cs.uregina.ca/~hamilton/courses/430/notes/rpcclient.c */ /*** Program Name: rpcclient.c Purpose: Acts like a feeble rsh client. Executes a command on another machine. How does it do this? Using UDP/IP (another protocal) a Remote proceedure has been defined which the client calls with a parameter of command. The returned result is a string of charaters resulting from the execution of the client's command on the remote machine. Why? Lets say there was a file on your friends machine that you needed. You could run this niffty program like: 'runc dec5ki cat herfile.c' and waaala, it would appear on your terminal. Nice eh! Notes: This program will run on hercules and the Dec stations. The C compiler on the Dec stations seem to be a tad less forgiving with pointers, so there will be a few warnings. This could easily be fixed by casting! The skeleton for this program was origionally written by Rob Kowalchuk By: Chad Holliday ***/ #include #include #include #include #include #include #include #include /* Added by MAS */ #include "hcrpc.h" #define COMMAND_LENGTH 4096 char *read_file(char *); int main(int argc, char **argv) { int result; static char *data2 ; char data[COMMAND_LENGTH]; if(argc !=3) { fprintf(stderr,"Usage: %s server command\n",argv[0]); exit(0); } data[0] = '\0' ; strcpy(data, argv[2]) ; data2 = data ; result = callrpc(argv[1], SERVICENUM, VERSION, PROCNUM, xdr_wrapstring, &data2, xdr_wrapstring, &data2); /* xdr_wrapstring is a command to transfer arrays of charaters */ fprintf(stdout,"%s",data2); return(1); }