summaryrefslogtreecommitdiffstats
path: root/share/examples/sunrpc/msg/msg_proc.c
blob: 96c1cb5ab0057a302eb42fbf6a5baec96ad0a726 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/* @(#)msg_proc.c	2.1 88/08/11 4.0 RPCSRC */
/*
 * msg_proc.c: implementation of the remote procedure "printmessage"
 */
#include <stdio.h>
#include <rpc/rpc.h>	/* always need this here */
#include "msg.h"	/* need this too: msg.h will be generated by rpcgen */

/*
 * Remote verson of "printmessage"
 */
int *
printmessage_1(msg)
	char **msg;
{
	static int result; /* must be static! */
	FILE *f;

	f = fopen("/dev/console", "w");
	if (f == NULL) {
		result = 0;
		return (&result);
	}
	fprintf(f, "%s\n", *msg);
	fclose(f);
	result = 1;
	return (&result);
}
OpenPOWER on IntegriCloud