xref: /freebsd/share/examples/sunrpc/msg/msg_proc.c (revision 8e6b01171e30297084bb0b4457c4183c2746aacc)
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 <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 verson 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("/dev/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