home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume4 / unaxcess / part2 / bull.c next >
Encoding:
C/C++ Source or Header  |  1986-11-30  |  1.1 KB  |  58 lines

  1. /*
  2.  * %W% %E% %U% ncoast!bsa %Z%
  3.  * %Z% Copyright (C) 1986 by Brandon S. Allbery, All Rights Reserved %Z%
  4.  */
  5.  
  6. #ifndef lint
  7. static char _SccsId[] = "%W% %E% %U% ncoast!bsa %Z%";
  8. static char _CopyRt[] = "%Z% Copyright (C) 1985 by Brandon S. Allbery %Z%";
  9. #endif  lint
  10.  
  11. #include "ua.h"
  12.  
  13. bulletin(s)
  14.     char *s;
  15.     {
  16.     short mcnt, himotd;
  17.     char tmps[256];
  18.     FILE *fp;
  19.  
  20.     if (user.u_access == A_MKUSER)
  21.         return;
  22.     sprintf(tmps, "%s/himotd", MOTD);
  23.     if ((fp = fopen(tmps, "r")) == NULL)
  24.     {
  25.     log("Error %d opening %s", errno, tmps);
  26.     panic("himotd");
  27.     }
  28.     fgets(tmps, 32, fp);
  29.     fclose(fp);
  30.     himotd = atoi(tmps);
  31.     for (mcnt = (strcmp(user.u_name, "guest") == 0? 0: user.u_nbull + 1); mcnt <= himotd; mcnt++)
  32.     {
  33.     sprintf(tmps, "%s/%d", MOTD, mcnt);
  34.     if (!readmotd(tmps, mcnt))
  35.         break;
  36.     }
  37.     }
  38.  
  39. readmotd(motd, mnum)
  40.     char *motd;
  41.     short mnum;
  42.     {
  43.     char line[256];
  44.  
  45.     printf("Bulletin #%d:\n", mnum);
  46.     cat(motd);
  47.     printf("\nContinue or Stop (C)? ");
  48.     if (!isatty(0) || nopause)
  49.     {
  50.     putchar('\n');
  51.     line[0] = '\0';
  52.     }
  53.     else
  54.     gets(line);
  55.     log("C/S? %s", line);
  56.     return ToLower(line[0]) != 's';
  57.     }
  58.