home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 2 / 2288 / motd.c < prev    next >
Encoding:
C/C++ Source or Header  |  1990-12-28  |  750 b   |  49 lines

  1. /*
  2.  * Copyright 1989, 1990, John F. Haugh II
  3.  * All rights reserved.
  4.  *
  5.  * Use, duplication, and disclosure prohibited without
  6.  * the express written permission of the author.
  7.  */
  8.  
  9. #include <stdio.h>
  10. #ifndef    BSD
  11. #include <string.h>
  12. #include <memory.h>
  13. #else
  14. #include <strings.h>
  15. #define    strchr    index
  16. #define    strrchr    rindex
  17. #endif
  18. #include "config.h"
  19.  
  20. #ifndef    lint
  21. static    char    _sccsid[] = "@(#)motd.c    2.2    19:23:58    7/29/90";
  22. #endif
  23.  
  24. extern    char    home[];
  25. #ifdef    HUSHLOGIN
  26. extern    int    hushed;
  27. #endif
  28.  
  29. #ifdef    MOTD
  30. void    motd ()
  31. {
  32.     FILE    *fp;
  33.     register int    c;
  34.  
  35. #ifdef    HUSHLOGIN
  36.     if (hushed)
  37.         return;
  38. #endif
  39.     if ((fp = fopen ("/etc/motd", "r")) == (FILE *) 0)
  40.         return;
  41.  
  42.     while ((c = getc (fp)) != EOF)
  43.         putchar (c);
  44.  
  45.     fclose (fp);
  46.     fflush (stdout);
  47. }
  48. #endif
  49.