home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume13 / rpc3.9 / part06 / demo / msg / msg_proc.c < prev    next >
Encoding:
C/C++ Source or Header  |  1988-02-27  |  562 b   |  29 lines

  1. /* @(#)msg_proc.c    1.1 87/11/04 3.9 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.