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

Defined functions

error defined in line 101; used 4 times
main defined in line 37; never used

Defined variables

sccsid defined in line 2; never used
users defined in line 10; used 1 times
  • in line 47
Last modified: 1982-10-25
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 942
Valid CSS Valid XHTML 1.0 Strict