1944fcc15SGarrett Wollman /* 2944fcc15SGarrett Wollman * msg_proc.c: implementation of the remote procedure "printmessage" 3944fcc15SGarrett Wollman */ 41a37aa56SDavid E. O'Brien #include <paths.h> 5944fcc15SGarrett Wollman #include <stdio.h> 6944fcc15SGarrett Wollman #include <rpc/rpc.h> /* always need this here */ 7944fcc15SGarrett Wollman #include "msg.h" /* need this too: msg.h will be generated by rpcgen */ 8944fcc15SGarrett Wollman 9944fcc15SGarrett Wollman /* 10*9faaeffdSEitan Adler * Remote version of "printmessage" 11944fcc15SGarrett Wollman */ 12944fcc15SGarrett Wollman int * printmessage_1(msg)13944fcc15SGarrett Wollmanprintmessage_1(msg) 14944fcc15SGarrett Wollman char **msg; 15944fcc15SGarrett Wollman { 16944fcc15SGarrett Wollman static int result; /* must be static! */ 17944fcc15SGarrett Wollman FILE *f; 18944fcc15SGarrett Wollman 191a37aa56SDavid E. O'Brien f = fopen(_PATH_CONSOLE, "w"); 20944fcc15SGarrett Wollman if (f == NULL) { 21944fcc15SGarrett Wollman result = 0; 22944fcc15SGarrett Wollman return (&result); 23944fcc15SGarrett Wollman } 24944fcc15SGarrett Wollman fprintf(f, "%s\n", *msg); 25944fcc15SGarrett Wollman fclose(f); 26944fcc15SGarrett Wollman result = 1; 27944fcc15SGarrett Wollman return (&result); 28944fcc15SGarrett Wollman } 29