1: #include <stdio.h>
   2: /*
   3:  * Dungeon - open UP dungeon
   4:  */
   5: 
   6: #ifdef CHECKUID
   7: int users[] = {
   8:     522,    /* sa */
   9:     164,    /* Leiby */
  10:     229,    /* richards */
  11:     264,    /* marshall */
  12:     1099,   /* wizard */
  13:     425,    /* clm */
  14:     15,     /* mowle */
  15:     32,     /* ghg */
  16:     27, /* qtip (zager) */
  17:     530,    /* mike */
  18:     16, /* bc */
  19:     333,    /* pdh */
  20:     230,    /* wa1yyn */
  21:     19, /* joe
  22: 	43,	/* bruner */
  23:     308,    /* gedeon (watch him closely!) */
  24:     429,    /* mayhew */
  25:     743,    /* alicia */
  26:     367,    /* feather */
  27:     85, /* clark bar */
  28:     382,    /* malcolm */
  29:     99, /* jones */
  30:     636,    /* gfg */
  31:     0 };
  32: #endif
  33: 
  34: main()
  35: {
  36: 
  37:     register int *up;
  38:     register uid;
  39:     int fd3, fd4, fd5;
  40: 
  41: #ifdef CHECKUID
  42: 
  43:     uid = getuid();
  44:     for (up=users; *up; up++)
  45:         if (*up == uid)
  46:             goto ok;
  47:     printf("You are not a Wizard!\n");
  48:     exit();
  49: #endif
  50:     /*
  51: 	 * open up files needed by program
  52: 	 * look in current directory first, then try default names
  53: 	 * The following files must be as follows:
  54: 	 * "dtext.dat" open read-only on fd 3
  55: 	 * "dindex.dat open read-only on fd 4 (maybe this file isn't used)
  56: 	 * "doverlay" open read-only on fd 5 (put this file on fast disk)
  57: 	 */
  58:     close(3);
  59:     close(4);
  60:     close(5);
  61:     if ((fd3 = open("dtext.dat", 0)) < 0)
  62:         if ((fd3 = open("/usr/games/lib/dtext.dat", 0)) < 0)
  63:             error("Can't open dtext.dat\n");
  64: 
  65:     if ((fd4 = open("dindex.dat", 0)) < 0)
  66:         if ((fd4 = open("/usr/games/lib/dindex.dat", 0)) < 0)
  67:             error("Can' open dindex.dat\n");
  68: 
  69:     if ((fd5 = open("doverlay", 0)) < 0)
  70:         if ((fd5 = open("/tmp/nedtmp/doverlay", 0)) < 0)
  71:             if ((fd5 = open("/usr/games/lib/doverlay", 0)) < 0)
  72:                 error("Can't open doverlay\n");
  73: 
  74:     if (fd3 != 3 || fd4 != 4 || fd5 != 5)
  75:         error("Files opened on wrong descriptors\n");
  76: 
  77:     signal(2,1);
  78: 
  79:     printf("You are in an open field west of a big white house with a boarded\n");
  80:     printf("front door.\n");
  81:     printf("There is a small mailbox here.\n>");
  82:     fflush(stdout);
  83: #ifdef pdp11
  84:     execl("dungeon","zork", 0);
  85:     execl("/usr/games/lib/dungeon","zork", 0);
  86: #else
  87:     if( (uid=open("dungeon", 0)) > 0 ) {
  88:         close(uid);
  89:         execlp("compat", "zork", "dungeon", 0);
  90:         execlp("/usr/games/lib/compat", "zork", "dungeon", 0);
  91:     }
  92:     execlp("compat", "zork", "/usr/games/lib/dungeon", 0);
  93:     execlp("/usr/games/lib/compat", "zork", "/usr/games/lib/dungeon", 0);
  94: #endif
  95:     printf("Can't start dungeons.\n");
  96:     exit(0);
  97: }
  98: error(s)
  99: char *s;
 100: {
 101:     printf("%s", s);
 102:     exit(1);
 103: }

Defined functions

error defined in line 98; used 4 times
main defined in line 34; never used

Defined variables

users defined in line 7; used 1 times
  • in line 44
Last modified: 1987-08-06
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 2885
Valid CSS Valid XHTML 1.0 Strict