1 /* 2 * msg_proc.c: implementation of the remote procedure "printmessage" 3 */ 4 #include <paths.h> 5 #include <stdio.h> 6 #include <rpc/rpc.h> /* always need this here */ 7 #include "msg.h" /* need this too: msg.h will be generated by rpcgen */ 8 9 /* 10 * Remote version of "printmessage" 11 */ 12 int * 13 printmessage_1(msg) 14 char **msg; 15 { 16 static int result; /* must be static! */ 17 FILE *f; 18 19 f = fopen(_PATH_CONSOLE, "w"); 20 if (f == NULL) { 21 result = 0; 22 return (&result); 23 } 24 fprintf(f, "%s\n", *msg); 25 fclose(f); 26 result = 1; 27 return (&result); 28 } 29