Merge from vendor branch GCC:
[dragonfly.git] / share / examples / sunrpc / msg / msg_proc.c
1 /* @(#)msg_proc.c       2.1 88/08/11 4.0 RPCSRC */
2 /* $FreeBSD: src/share/examples/sunrpc/msg/msg_proc.c,v 1.2.12.1 2000/12/11 01:03:27 obrien Exp $ */
3 /* $DragonFly: src/share/examples/sunrpc/msg/msg_proc.c,v 1.2 2003/06/17 04:36:58 dillon Exp $ */
4 /*
5  * msg_proc.c: implementation of the remote procedure "printmessage"
6  */
7 #include <paths.h>
8 #include <stdio.h>
9 #include <rpc/rpc.h>    /* always need this here */
10 #include "msg.h"        /* need this too: msg.h will be generated by rpcgen */
11
12 /*
13  * Remote verson of "printmessage"
14  */
15 int *
16 printmessage_1(msg)
17         char **msg;
18 {
19         static int result; /* must be static! */
20         FILE *f;
21
22         f = fopen(_PATH_CONSOLE, "w");
23         if (f == NULL) {
24                 result = 0;
25                 return (&result);
26         }
27         fprintf(f, "%s\n", *msg);
28         fclose(f);
29         result = 1;
30         return (&result);
31 }