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