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