/share/examples/sunrpc/msg/msg_proc.c

https://bitbucket.org/freebsd/freebsd-head/ · C · 30 lines · 20 code · 2 blank · 8 comment · 2 complexity · d8422d25a9d0d22e663023388478f765 MD5 · raw file

  1. /* @(#)msg_proc.c 2.1 88/08/11 4.0 RPCSRC */
  2. /* $FreeBSD$ */
  3. /*
  4. * msg_proc.c: implementation of the remote procedure "printmessage"
  5. */
  6. #include <paths.h>
  7. #include <stdio.h>
  8. #include <rpc/rpc.h> /* always need this here */
  9. #include "msg.h" /* need this too: msg.h will be generated by rpcgen */
  10. /*
  11. * Remote verson of "printmessage"
  12. */
  13. int *
  14. printmessage_1(msg)
  15. char **msg;
  16. {
  17. static int result; /* must be static! */
  18. FILE *f;
  19. f = fopen(_PATH_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. }