home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 9 / FreshFishVol9-CD2.bin / bbs / comm / amitcp-sdk-4.0.lha / AmiTCP-SDK / src / examples / rpc / msg / msg_proc.c next >
Encoding:
C/C++ Source or Header  |  1994-03-09  |  649 b   |  35 lines

  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_svc(char **msg, struct svc_req *rqstp)
  14. {
  15.     static int result; /* must be static! */
  16.     FILE *f;
  17.  
  18. #ifdef amigados
  19.     f = stdout;
  20. #else
  21.     f = fopen("/dev/console", "w");
  22. #endif
  23.     if (f == NULL) {
  24.         result = 0;
  25.         return (&result);
  26.     }
  27.     fprintf(f, "%s\n", *msg);
  28. #ifndef amigados
  29.     fclose(f);
  30. #endif
  31.     result = 1;
  32.     return (&result);
  33. }
  34.  
  35.