1: static char sccsid[] = "	okplay.c	4.1	82/05/11	";
   2: 
   3: main(argc, argv)
   4: int argc; char *argv[];
   5: {
   6:     argv[argc] = 0;
   7:     okplay();
   8:     if (argc == 1)
   9:         advmotd();
  10:     execv("/usr/games/lib/adventure", argv);
  11:     write(2, "No adventure just now\n", 22);
  12:     exit(1);
  13: }
  14: 
  15: okplay()
  16: {
  17:     int tvec[2];
  18:     register struct local {
  19:         int seconds,minutes,hours,daymo,month,year,daywk,dayyr,dst;
  20:     } *local;
  21: 
  22:     return;
  23:     time(tvec);
  24:     local = localtime(tvec);
  25:     local->month++;
  26:     if (local->daywk == 6||local->daywk == 0)
  27:         return;
  28:     if (local->hours>=9&&local->hours<18)
  29:         if (!holiday(local->month, local->daymo))
  30:             notinprime();
  31: }
  32: 
  33: holiday(mo,da)
  34:     int mo,da;
  35: {
  36:     int stbuf[30];
  37:     char *np, *op;
  38: 
  39:     np = "/usr/games/holiday/XXXX";
  40:     for(op=np;*op;op++);
  41:     *--op=(da%10)|'0';
  42:     *--op=(da/10)|'0';
  43:     *--op=(mo%10)|'0';
  44:     *--op=(mo/10)|'0';
  45:     return(stat(np,stbuf) == 0);
  46: }
  47: char notinm[] "No adventure in prime time (M-F 9am-5pm) except on holidays\n";
  48: 
  49: notinprime()
  50: {
  51:     write(2, notinm, sizeof notinm);
  52:     exit(1);
  53: }
  54: 
  55: advmotd()
  56: {
  57:     char ch;
  58:     int fd;
  59: 
  60:     fd = open("/usr/games/lib/advmotd", 0);
  61:     if (fd < 0) return;
  62:     while(read(fd,&ch,1) ==1) write(1,&ch,1);
  63:     close(fd);
  64: }

Defined functions

advmotd defined in line 55; used 1 times
  • in line 9
holiday defined in line 33; used 1 times
  • in line 29
main defined in line 3; never used
notinprime defined in line 49; used 1 times
  • in line 30
okplay defined in line 15; used 1 times
  • in line 7

Defined variables

notinm defined in line 47; used 2 times
  • in line 51(2)
sccsid defined in line 1; never used

Defined struct's

local defined in line 18; never used
Last modified: 1982-06-09
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 2407
Valid CSS Valid XHTML 1.0 Strict