186d7f5d3SJohn Marino /* @(#)msg_proc.c 2.1 88/08/11 4.0 RPCSRC */ 286d7f5d3SJohn Marino /* $FreeBSD: src/share/examples/sunrpc/msg/msg_proc.c,v 1.2.12.1 2000/12/11 01:03:27 obrien Exp $ */ 386d7f5d3SJohn Marino /* $DragonFly: src/share/examples/sunrpc/msg/msg_proc.c,v 1.2 2003/06/17 04:36:58 dillon Exp $ */ 486d7f5d3SJohn Marino /* 586d7f5d3SJohn Marino * msg_proc.c: implementation of the remote procedure "printmessage" 686d7f5d3SJohn Marino */ 786d7f5d3SJohn Marino #include <paths.h> 886d7f5d3SJohn Marino #include <stdio.h> 986d7f5d3SJohn Marino #include <rpc/rpc.h> /* always need this here */ 1086d7f5d3SJohn Marino #include "msg.h" /* need this too: msg.h will be generated by rpcgen */ 1186d7f5d3SJohn Marino 1286d7f5d3SJohn Marino /* 1386d7f5d3SJohn Marino * Remote verson of "printmessage" 1486d7f5d3SJohn Marino */ 1586d7f5d3SJohn Marino int * printmessage_1(msg)1686d7f5d3SJohn Marinoprintmessage_1(msg) 1786d7f5d3SJohn Marino char **msg; 1886d7f5d3SJohn Marino { 1986d7f5d3SJohn Marino static int result; /* must be static! */ 2086d7f5d3SJohn Marino FILE *f; 2186d7f5d3SJohn Marino 2286d7f5d3SJohn Marino f = fopen(_PATH_CONSOLE, "w"); 2386d7f5d3SJohn Marino if (f == NULL) { 2486d7f5d3SJohn Marino result = 0; 2586d7f5d3SJohn Marino return (&result); 2686d7f5d3SJohn Marino } 2786d7f5d3SJohn Marino fprintf(f, "%s\n", *msg); 2886d7f5d3SJohn Marino fclose(f); 2986d7f5d3SJohn Marino result = 1; 3086d7f5d3SJohn Marino return (&result); 3186d7f5d3SJohn Marino } 32