home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / games / volume7 / nethack3 / patch4h / patches04h
Text File  |  1989-10-02  |  57KB  |  2,025 lines

  1. *** auxil/Old/help    Wed Sep 27 10:17:39 1989
  2. --- auxil/help    Thu Sep 14 13:20:36 1989
  3. ***************
  4. *** 139,149 ****
  5.           the commands you can use with "#" type "#?".  The extended
  6.           commands you can use depends upon what options the game was
  7.           compiled with, along with your class and what type of monster
  8. !         you most closely resemble at a given moment. If your keyboard
  9. !         has a meta key (that is, one which when pressed in combination
  10. !         with another key modified it by turning on the 'meta' or 0x80
  11. !         bit) these extended commands can be invoked by meta-ing the
  12. !         first letter of the command.
  13.   
  14.       If the "number_pad" option is on, some additional letter commands
  15.       are available:
  16. --- 139,149 ----
  17.           the commands you can use with "#" type "#?".  The extended
  18.           commands you can use depends upon what options the game was
  19.           compiled with, along with your class and what type of monster
  20. !         you most closely resemble at a given moment.  If your keyboard
  21. !         has a meta key (which, when pressed in combination with another
  22. !         key, modifies it by setting the 'meta' (8th, or 'high') bit),
  23. !         these extended commands can be invoked by meta-ing the first
  24. !         letter of the command.
  25.   
  26.       If the "number_pad" option is on, some additional letter commands
  27.       are available:
  28. *** auxil/Old/hh    Wed Sep 27 10:17:53 1989
  29. --- auxil/hh    Thu Sep 14 13:20:41 1989
  30. ***************
  31. *** 7,59 ****
  32.               G<dir>,   same, except a branching corridor isn't
  33.               ^<dir>:     considered interesting
  34.               m<dir>:   move without picking up objects
  35. !         If the numberpad option is set, the number keys move instead.
  36.   
  37. ! Meta commands:
  38. ! ?    help    print one of several informative texts
  39.   Q    quit    end the game
  40.   S    save    save the game (to be continued later)
  41.   !    sh    escape to some SHELL (if allowed)
  42.   ^Z    suspend suspend the game (independent of your current suspend char)
  43.   O    options set options
  44. ! /    whatis    give name (and sometimes more info) of specified monster
  45. ! \    known    print list of what's been discovered
  46. ! v    version    print version number
  47. ! V    history    print game history
  48. ! ^A    again    redo the previous command
  49. ! ^R    redraw    redraw the screen (^R denotes the symbol CTRL/R)
  50. ! ^P    print    repeat last message  (subsequent ^P's repeat earlier messages)
  51. ! #        introduces a long command (# ? for list of long commands)
  52.   
  53.   Game commands:
  54. - ^T    'port    teleport (if you can)
  55.   ^D    kick    kick (a door, or something else)
  56.   a    apply    apply or use a tool (pick-axe, key, camera, etc.)
  57. ! A    remove    take off all armor
  58.   c    close    close a door
  59. ! C    name    name an individual monster (e.g., baptize your dog)
  60.   d    drop    drop an object.  d7a:  drop seven items of object 'a'
  61. ! D    drop    drop several things
  62.   e    eat    eat something
  63.   E    engrave write a message in the dust on the floor  (E-  use fingers)
  64. ! i    invent    list the inventory (all objects you are carrying)
  65. ! I    invent    list selected parts of the inventory
  66.           Iu: list unpaid objects
  67.           Ix: list unpaid but used up items
  68.           I$: count your money
  69.   o    open    open a door
  70. ! p    pay    pay your bill
  71. ! P    wear    put on a ring
  72.   q    quaff    drink a potion
  73.   r    read    read a scroll or spell book
  74.   R    remove    remove a ring
  75.   s    search    search for secret doors, hidden traps and monsters
  76.   t    throw    throw or shoot a weapon
  77. ! T    remove    take off some armor
  78.   w    wield    wield a weapon    (w-  wield nothing)
  79.   W    wear    put on some armor
  80.   z    zap    zap a wand
  81. ! Z    cast    cast a spell
  82.   <    up    go up the stairs
  83.   >    down    go down the stairs
  84.   ^    trap_id identify a previously found trap
  85. --- 7,59 ----
  86.               G<dir>,   same, except a branching corridor isn't
  87.               ^<dir>:     considered interesting
  88.               m<dir>:   move without picking up objects
  89. !         If the number_pad option is set, the number keys move instead.
  90.   
  91. ! General commands:
  92. ! ?    help    display one of several informative texts
  93.   Q    quit    end the game
  94.   S    save    save the game (to be continued later)
  95.   !    sh    escape to some SHELL (if allowed)
  96.   ^Z    suspend suspend the game (independent of your current suspend char)
  97.   O    options set options
  98. ! /    whatis    tell what a map symbol represents
  99. ! \    known    display list of what's been discovered
  100. ! v    version    display version number
  101. ! V    history    display game history
  102. ! ^A    again    redo the previous command (^A denotes the keystroke CTRL-A)
  103. ! ^R    redraw    redraw the screen
  104. ! ^P    prevmsg    repeat previous message (subsequent ^P's repeat earlier ones)
  105. ! #        introduces an extended command (#? for a list of them)
  106.   
  107.   Game commands:
  108.   ^D    kick    kick (a door, or something else)
  109. + ^T    'port    teleport (if you can)
  110.   a    apply    apply or use a tool (pick-axe, key, camera, etc.)
  111. ! A    armor    take off all armor
  112.   c    close    close a door
  113. ! C    call    name an individual monster (ex. baptize your dog)
  114.   d    drop    drop an object.  d7a:  drop seven items of object 'a'
  115. ! D    Drop    drop selected types of objects
  116.   e    eat    eat something
  117.   E    engrave write a message in the dust on the floor  (E-  use fingers)
  118. ! i    invent    list your inventory (all objects you are carrying)
  119. ! I    Invent    list selected parts of your inventory
  120.           Iu: list unpaid objects
  121.           Ix: list unpaid but used up items
  122.           I$: count your money
  123.   o    open    open a door
  124. ! p    pay    pay your bill (in a shop)
  125. ! P    puton    put on a ring
  126.   q    quaff    drink a potion
  127.   r    read    read a scroll or spell book
  128.   R    remove    remove a ring
  129.   s    search    search for secret doors, hidden traps and monsters
  130.   t    throw    throw or shoot a weapon
  131. ! T    takeoff    take off some armor
  132.   w    wield    wield a weapon    (w-  wield nothing)
  133.   W    wear    put on some armor
  134.   z    zap    zap a wand
  135. ! Z    Zap    cast a spell
  136.   <    up    go up the stairs
  137.   >    down    go down the stairs
  138.   ^    trap_id identify a previously found trap
  139. ***************
  140. *** 62,78 ****
  141.   +    spells    list the spells you know
  142.   .    rest    wait a moment
  143.   ,    pickup    pick up all you can carry
  144. ! @        turn "autopickup" on and off
  145.   :    look    look at what is here
  146.   
  147. ! And if the "number_pad" option is on, these additional commands:
  148.   
  149.   n        followed by number of times to repeat the next command
  150. ! j    jump    jump to a location
  151. ! k    kick    kick a door
  152.   l    loot    loot a box on the floor
  153. ! N    name    name an object or type of object
  154. ! u    untrap    untrap a trapped object
  155. ! If your keyboard has a meta key, 'jump' 'loot', 'name' and 'untrap' are
  156. ! available as M-j, M-l, M-N or M-u respectively.
  157. --- 62,92 ----
  158.   +    spells    list the spells you know
  159.   .    rest    wait a moment
  160.   ,    pickup    pick up all you can carry
  161. ! @        toggle "pickup" (auto pickup) option on and off
  162.   :    look    look at what is here
  163.   
  164. ! Keyboards that have a meta key can also use these extended commands:
  165. ! M-c    chat    talk to someone
  166. ! M-d    dip    dip an object into something
  167. ! M-f    force    force a lock
  168. ! M-j    jump    jump to another location
  169. ! M-l    loot    loot a box on the floor
  170. ! M-m    monster    use a monster's special ability (only if defined)
  171. ! M-N    name    name an item or type of object
  172. ! M-o    offer    offer a sacrifice to the gods (only if defined)
  173. ! M-p    pray    pray to the gods for help (only if defined)
  174. ! M-r    rub    rub a lamp
  175. ! M-s    sit    sit down
  176. ! M-t    turn    turn undead
  177. ! M-u    untrap    untrap something (usually a trapped object)
  178. ! M-w    wipe    wipe off your face
  179.   
  180. + If the "number_pad" option is on, these additional commands are available:
  181.   n        followed by number of times to repeat the next command
  182. ! j    jump    jump to another location
  183. ! k    kick    kick something (usually a door)
  184.   l    loot    loot a box on the floor
  185. ! N    name    name an item or type of object
  186. ! u    untrap    untrap something (usually a trapped object)
  187. *** auxil/Old/history    Wed Sep 27 10:18:08 1989
  188. --- auxil/history    Sat Sep 16 17:54:33 1989
  189. ***************
  190. *** 29,34 ****
  191. --- 29,35 ----
  192.   
  193.   Timo Hakulinen ported NetHack 3.0 to OS/2.
  194.   
  195. + David Gentzel ported NetHack 3.0 to VMS.
  196.    
  197.   From time to time, some depraved individual out there in netland sends a
  198.   particularly intriguing modification to help out with the game.  The Gods of
  199. *** auxil/Old/nethack.6    Wed Sep 27 10:18:41 1989
  200. --- auxil/nethack.6    Sun Sep 17 12:29:03 1989
  201. ***************
  202. *** 99,106 ****
  203.   .B \-D
  204.   or
  205.   .B \-X
  206. ! option will start the game in a special non-scoring discovery mode
  207. ! (or in debugging (wizard) mode if the player is the game administrator).
  208.   .PP
  209.   The
  210.   .B \-d
  211. --- 99,108 ----
  212.   .B \-D
  213.   or
  214.   .B \-X
  215. ! option will start the game in a special non-scoring discovery mode.
  216. ! .B \-D
  217. ! will, if the player is the game administrator, start in debugging (wizard)
  218. ! mode instead.
  219.   .PP
  220.   The
  221.   .B \-d
  222. *** auxil/Old/opthelp    Wed Sep 27 10:19:01 1989
  223. --- auxil/opthelp    Thu Sep 14 14:46:43 1989
  224. ***************
  225. *** 34,43 ****
  226.   null        allow nulls to be sent to your terminal  [TRUE]
  227.   standout    use standout mode for --More-- on messages  [FALSE]
  228.   
  229. ! Any Boolean option can be negated by prefixing it with a '!' or 'no'.
  230.   
  231.   
  232.   
  233.   
  234. --- 34,43 ----
  235.   null        allow nulls to be sent to your terminal  [TRUE]
  236.   standout    use standout mode for --More-- on messages  [FALSE]
  237.   
  238. ! Boolean option if TEXTCOLOR was set at compile time:
  239. ! color        use different colors for objects on screen  [TRUE]
  240.   
  241. ! Any Boolean option can be negated by prefixing it with a '!' or 'no'.
  242.   
  243.   
  244.   
  245. *** include/Old/amiconf.h    Wed Sep 27 13:08:56 1989
  246. --- include/amiconf.h    Thu Sep 14 23:31:24 1989
  247. ***************
  248. *** 1,4 ****
  249. ! /*      SCCS Id: @(#)amiconf.h  3.0     89/04/28
  250.   /* NetHack may be freely redistributed.  See license for details. */
  251.   
  252.   #ifndef AMICONF_H
  253. --- 1,4 ----
  254. ! /*    SCCS Id: @(#)amiconf.h  3.0     89/09/04
  255.   /* NetHack may be freely redistributed.  See license for details. */
  256.   
  257.   #ifndef AMICONF_H
  258. ***************
  259. *** 22,27 ****
  260. --- 22,30 ----
  261.   
  262.   #undef  index
  263.   #undef  rindex
  264. + extern char  *index P((const char *,int));
  265. + extern char  *rindex P((const char *,int));
  266. + #define memcpy(dest, source, size)  movmem(source, dest, size)
  267.   
  268.   /*
  269.    *  Configurable Amiga options:
  270. *** include/Old/artifact.h    Wed Sep 27 13:09:09 1989
  271. --- include/artifact.h    Mon Sep 25 20:58:06 1989
  272. ***************
  273. *** 6,32 ****
  274.   #ifndef ARTIFACT_H
  275.   #define ARTIFACT_H
  276.   
  277. ! #define SPFX_NONE   0x00    /* no special effects, just a bonus */
  278. ! #define SPFX_NOGEN  0x01    /* item is special, bequeathed by gods */
  279. ! #define SPFX_RESTR  0x02    /* item is restricted - can't be named */
  280. ! #define    SPFX_INTEL  0x04    /* item is self-willed - intelligent */
  281. ! #define SPFX_SPEEK  0x08    /* item can speak */
  282. ! #define SPFX_SEEK   0x10    /* item helps you search for things */
  283. ! #define SPFX_WARN   0x20    /* item warns you of danger */
  284. ! #define SPFX_ATTK   0x40    /* item has a special attack (attk) */
  285. ! #define SPFX_DEFN   0x80    /* item has a special defence (defn) */
  286. ! #define SPFX_DMONS  0x100    /* attack bonus on one type of monster */
  287. ! #define    SPFX_DCLAS  0x200    /* attack bonus on one class of monster */
  288. ! #define SPFX_DRLI   0x400    /* drains a level from monsters */
  289. ! #define SPFX_SEARCH 0x800    /* helps searching */
  290.   
  291.   struct artifact {
  292.       unsigned    otyp;
  293.       char        *name;
  294.       unsigned    spfx;
  295. !     unsigned    mtype;
  296.       struct attack attk, defn;
  297. !     unsigned    align;
  298.   };
  299.   
  300.   #endif /* ARTIFACT_H /* */
  301. --- 6,37 ----
  302.   #ifndef ARTIFACT_H
  303.   #define ARTIFACT_H
  304.   
  305. ! #define SPFX_NONE   0x0000    /* no special effects, just a bonus */
  306. ! #define SPFX_NOGEN  0x0001    /* item is special, bequeathed by gods */
  307. ! #define SPFX_RESTR  0x0002    /* item is restricted - can't be named */
  308. ! #define    SPFX_INTEL  0x0004    /* item is self-willed - intelligent */
  309. ! #define SPFX_SPEEK  0x0008    /* item can speak */
  310. ! #define SPFX_SEEK   0x0010    /* item helps you search for things */
  311. ! #define SPFX_WARN   0x0020    /* item warns you of danger */
  312. ! #define SPFX_ATTK   0x0040    /* item has a special attack (attk) */
  313. ! #define SPFX_DEFN   0x0080    /* item has a special defence (defn) */
  314. ! #define SPFX_DRLI   0x0100    /* drains a level from monsters */
  315. ! #define SPFX_SEARCH 0x0200    /* helps searching */
  316. ! #define SPFX_DMONS  0x1000    /* attack bonus on one monster type */
  317. ! #define    SPFX_DCLAS  0x2000    /* attack bonus on monsters w/ symbol mtype */
  318. ! #define    SPFX_DFLAG1 0x4000    /* attack bonus on monsters w/ mflags1 flag */
  319. ! #define    SPFX_DFLAG2 0x8000    /* attack bonus on monsters w/ mflags2 flag */
  320.   
  321. + #define SPFX_DBONUS 0xF000    /* attack bonus mask */
  322.   struct artifact {
  323.       unsigned    otyp;
  324.       char        *name;
  325.       unsigned    spfx;
  326. !     unsigned long mtype;    /* monster type, symbol, or flag */
  327.       struct attack attk, defn;
  328. !     uchar        align;    /* alignment of bequeathing gods */
  329. !     char        class;    /* character class associated with */
  330.   };
  331.   
  332.   #endif /* ARTIFACT_H /* */
  333. *** include/Old/config.h    Wed Sep 27 13:09:29 1989
  334. --- include/config.h    Mon Sep 25 20:55:44 1989
  335. ***************
  336. *** 9,15 ****
  337.   /*
  338.    * Section 1:    OS selection.
  339.    *        Select the version of the OS you are using.
  340. !  *        For "UNIX" select either SYSV or BSD in unixconf.h
  341.    */
  342.   
  343.   #define    UNIX        /* delete if no fork(), exec() available */
  344. --- 9,17 ----
  345.   /*
  346.    * Section 1:    OS selection.
  347.    *        Select the version of the OS you are using.
  348. !  *        For "UNIX" select either SYSV or BSD in unixconf.h.
  349. !  *        A "VMS" option is not needed since the VMS C-compiler
  350. !  *        provides it (comment out the default OS option here).
  351.    */
  352.   
  353.   #define    UNIX        /* delete if no fork(), exec() available */
  354. *** include/Old/decl.h    Wed Sep 27 13:09:52 1989
  355. --- include/decl.h    Tue Sep 26 12:59:11 1989
  356. ***************
  357. *** 13,24 ****
  358.   E int nroom;
  359.   E int multi;
  360.   E int hackpid;
  361. ! #ifdef UNIX
  362.   E int locknum;
  363.   #ifdef DEF_PAGER
  364.   E char *catmore;
  365.   #endif    /* DEF_PAGER */
  366. - #endif    /* UNIX */
  367.   E char SAVEF[];
  368.   E char *hname;
  369.   E const char *hu_stat[];    /* defined in eat.c */
  370. --- 13,24 ----
  371.   E int nroom;
  372.   E int multi;
  373.   E int hackpid;
  374. ! #if defined(UNIX) || defined(VMS)
  375.   E int locknum;
  376. + #endif
  377.   #ifdef DEF_PAGER
  378.   E char *catmore;
  379.   #endif    /* DEF_PAGER */
  380.   E char SAVEF[];
  381.   E char *hname;
  382.   E const char *hu_stat[];    /* defined in eat.c */
  383. ***************
  384. *** 97,103 ****
  385.   E coord dig_pos;
  386.   E boolean dig_down;
  387.   
  388. ! E long moves;
  389.   E long wailmsg;
  390.   
  391.   E boolean in_mklev;
  392. --- 97,103 ----
  393.   E coord dig_pos;
  394.   E boolean dig_down;
  395.   
  396. ! E long moves, monstermoves;
  397.   E long wailmsg;
  398.   
  399.   E boolean in_mklev;
  400. ***************
  401. *** 121,134 ****
  402.   #endif
  403.   
  404.   #ifdef TEXTCOLOR
  405.   #define RED        1
  406.   #define GREEN        2
  407. ! #define YELLOW        3
  408.   #define BLUE        4
  409.   #define MAGENTA     5
  410.   #define CYAN        6
  411.   #define WHITE        7
  412. ! E char *HI_COLOR[8];    /* termcap.c */
  413.   #endif
  414.   
  415.   #ifndef OBJ_H
  416. --- 121,158 ----
  417.   #endif
  418.   
  419.   #ifdef TEXTCOLOR
  420. + #define BLACK        0
  421.   #define RED        1
  422.   #define GREEN        2
  423. ! #define BROWN        3    /* on IBM, lo-intensity yellow is brown */
  424.   #define BLUE        4
  425.   #define MAGENTA     5
  426.   #define CYAN        6
  427.   #define WHITE        7
  428. ! #define GRAY        7    /* lo-intensity white */
  429. ! #define BRIGHT        8
  430. ! #define ORANGE_COLORED    9
  431. ! #define YELLOW        11
  432. ! #define MAXCOLORS    16    /* 8 basic + 8 bright */
  433. ! /* these can be configured */
  434. ! #  define HI_MON    RED + BRIGHT        /* red slaps! */
  435. ! #  define HI_OBJ    MAGENTA
  436. ! #  define HI_METAL    CYAN
  437. ! #  define HI_COPPER    YELLOW
  438. ! #  define HI_SILVER    GRAY
  439. ! #  define HI_GOLD    YELLOW
  440. ! #  define HI_LEATHER    BROWN
  441. ! #  define HI_CLOTH    BROWN
  442. ! #  define HI_ORGANIC    GREEN
  443. ! #  define HI_WOOD    BROWN
  444. ! #  define HI_PAPER    BROWN
  445. ! #  define HI_GLASS    CYAN + BRIGHT
  446. ! #  define HI_MINERAL    GRAY
  447. ! #  define HI_ZAP    BLUE + BRIGHT        /* blue zaps! */
  448. ! E char *hilites[MAXCOLORS];
  449.   #endif
  450.   
  451.   #ifndef OBJ_H
  452. *** include/Old/extern.h    Wed Sep 27 13:10:43 1989
  453. --- include/extern.h    Tue Sep 26 19:11:23 1989
  454. ***************
  455. *** 5,11 ****
  456.   #ifndef EXTERN_H
  457.   #define EXTERN_H
  458.   
  459. ! #if defined(MSDOS) && !defined(__TURBOC__)
  460.   /* MSC include files do not contain "extern" keyword */
  461.   #define E
  462.   #else
  463. --- 5,11 ----
  464.   #ifndef EXTERN_H
  465.   #define EXTERN_H
  466.   
  467. ! #if defined(MSDOS) && defined(MSC)
  468.   /* MSC include files do not contain "extern" keyword */
  469.   #define E
  470.   #else
  471. ***************
  472. *** 12,17 ****
  473. --- 12,25 ----
  474.   #define E extern
  475.   #endif
  476.   
  477. + /* ### allmain.c ### */
  478. + E int (*occupation)();
  479. + E int (*afternmv)();
  480. + E void moveloop();
  481. + E void stop_occupation();
  482. + E void newgame();
  483.   /* ### alloc.c ### */
  484.   
  485.   #ifndef __TURBOC__
  486. ***************
  487. *** 341,348 ****
  488.   E void delobj P((struct obj *));
  489.   E void freeobj P((struct obj *));
  490.   E void freegold P((struct gold *));
  491. - E struct monst *m_at P((int,int));
  492. - E struct obj *o_at P((int,int));
  493.   E struct obj *sobj_at P((int,int,int));
  494.   E int carried P((struct obj *));
  495.   E struct obj *carrying P((int));
  496. --- 349,354 ----
  497. ***************
  498. *** 404,410 ****
  499.   E void enexto P((coord *,XCHAR_P,XCHAR_P,struct permonst *));
  500.   E int goodpos P((int,int, struct permonst *));
  501.   E void rloc P((struct monst *));
  502. - E struct monst *mkmon_at P((char *,int,int));
  503.   E void init_monstr();
  504.   E struct permonst *rndmonst();
  505.   E struct permonst *mkclass P((CHAR_P));
  506. --- 410,415 ----
  507. ***************
  508. *** 490,496 ****
  509.   E boolean is_rustprone P((struct obj *));
  510.   E boolean is_corrodeable P((struct obj *));
  511.   #endif
  512. - E boolean OBJ_AT P((int,int));
  513.   E void place_object P((struct obj *,int,int));
  514.   E void move_object P((struct obj *,int,int));
  515.   E void remove_object P((struct obj *));
  516. --- 495,500 ----
  517. ***************
  518. *** 528,534 ****
  519.   E void unstuck P((struct monst *));
  520.   E void killed P((struct monst *));
  521.   E void xkilled P((struct monst *,int));
  522. - E void kludge V((char *,char *,...));
  523.   E void rescham();
  524.   E void restartcham();
  525.   E int newcham P((struct monst *,struct permonst *));
  526. --- 532,537 ----
  527. ***************
  528. *** 578,583 ****
  529. --- 581,592 ----
  530.   E int m_move P((struct monst *,int));
  531.   E void set_apparxy P((struct monst *));
  532.   E boolean mdig_tunnel P((struct monst *));
  533. + #ifdef STUPID_CPP
  534. + E void place_monster P((struct monst *, int, int));
  535. + E void place_worm_seg P((struct monst *, int, int));
  536. + E void remove_monster P((int, int));
  537. + E struct monst *m_at P((int, int));
  538. + #endif
  539.   
  540.   /* ### monst.c ### */
  541.   
  542. ***************
  543. *** 617,627 ****
  544.   #ifdef TOS
  545.   E int _copyfile P((char *, char *));
  546.   E int kbhit();
  547.   #endif /* TOS */
  548.   
  549.   /* ### mthrowu.c ### */
  550.   
  551. ! E int thitu P((int,int,char *));
  552.   E int thrwmu P((struct monst *));
  553.   E int spitmu P((struct monst *));
  554.   E int breamu P((struct monst *,struct attack *));
  555. --- 626,638 ----
  556.   #ifdef TOS
  557.   E int _copyfile P((char *, char *));
  558.   E int kbhit();
  559. + E void restore_colors();
  560. + E void set_colors();
  561.   #endif /* TOS */
  562.   
  563.   /* ### mthrowu.c ### */
  564.   
  565. ! E int thitu P((int,int,struct obj *,char *));
  566.   E int thrwmu P((struct monst *));
  567.   E int spitmu P((struct monst *));
  568.   E int breamu P((struct monst *,struct attack *));
  569. ***************
  570. *** 657,663 ****
  571.   E void lcase P((char *));
  572.   E char *makeplural P((char *));
  573.   E struct obj *readobjnam P((char *));
  574. - E boolean uses_known P((struct obj *));
  575.   
  576.   /* ### options.c ### */
  577.   
  578. --- 668,673 ----
  579. ***************
  580. *** 689,708 ****
  581.   #ifdef SHELL
  582.   E int dosh();
  583.   #endif /* SHELL */
  584.   E int child P((int));
  585.   #endif /* UNIX */
  586.   
  587.   /* ### pcmain.c ### */
  588.   
  589.   #ifdef MSDOS
  590. - E int (*occupation)();
  591. - E int (*afternmv)();
  592.   E void askname();
  593. - E void impossible V((char *,...));
  594.   #ifdef CHDIR
  595.   E void chdirx P((char *,BOOLEAN_P));
  596.   #endif /* CHDIR */
  597. - E void stop_occupation();
  598.   #endif /* MSDOS */
  599.   
  600.   /* ### pctty.c ### */
  601. --- 699,716 ----
  602.   #ifdef SHELL
  603.   E int dosh();
  604.   #endif /* SHELL */
  605. + #if defined(SHELL) || defined(DEF_PAGER) || defined(DEF_MAILREADER)
  606.   E int child P((int));
  607. + #endif
  608.   #endif /* UNIX */
  609.   
  610.   /* ### pcmain.c ### */
  611.   
  612.   #ifdef MSDOS
  613.   E void askname();
  614.   #ifdef CHDIR
  615.   E void chdirx P((char *,BOOLEAN_P));
  616.   #endif /* CHDIR */
  617.   #endif /* MSDOS */
  618.   
  619.   /* ### pctty.c ### */
  620. ***************
  621. *** 957,963 ****
  622.   E void pay_for_door P((int,int,char *));
  623.   E void addtobill P((struct obj *,BOOLEAN_P));
  624.   E void splitbill P((struct obj *,struct obj *));
  625. ! E void subfrombill P((struct obj *));
  626.   E int doinvbill P((int));
  627.   E int shkcatch P((struct obj *));
  628.   E int shk_move P((struct monst *));
  629. --- 965,971 ----
  630.   E void pay_for_door P((int,int,char *));
  631.   E void addtobill P((struct obj *,BOOLEAN_P));
  632.   E void splitbill P((struct obj *,struct obj *));
  633. ! E void sellobj P((struct obj *));
  634.   E int doinvbill P((int));
  635.   E int shkcatch P((struct obj *));
  636.   E int shk_move P((struct monst *));
  637. ***************
  638. *** 1060,1072 ****
  639. --- 1068,1087 ----
  640.   E void more();
  641.   E void cmore P((char *));
  642.   E void clrlin();
  643. + #ifdef NEED_VARARGS
  644. + #if defined(USE_STDARG) || defined(USE_VARARGS)
  645. + E void vpline P((const char *, va_list));
  646. + #endif
  647. + #endif
  648.   E void pline V((const char *,...));
  649.   E void Norep V((const char *,...));
  650.   E void You V((const char *,...));
  651.   E void Your V((const char *,...));
  652. + E void kludge V((char *,char *,...));
  653.   E void putsym P((CHAR_P));
  654.   E void putstr P((char *));
  655.   E char yn_function P((char *,CHAR_P));
  656. + E void impossible V((char *,...));
  657.   
  658.   /* ### topten.c ### */
  659.   
  660. ***************
  661. *** 1129,1140 ****
  662.   /* ### unixmain.c ### */
  663.   
  664.   #ifdef UNIX
  665. - E int (*occupation)();
  666. - E int (*afternmv)();
  667.   E void glo P((int));
  668.   E void askname();
  669. - E void impossible V((char *,...));
  670. - E void stop_occupation();
  671.   #endif /* UNIX */
  672.   
  673.   /* ### unixtty.c ### */
  674. --- 1144,1151 ----
  675. ***************
  676. *** 1175,1180 ****
  677. --- 1186,1241 ----
  678.   /* ### version.c ### */
  679.   
  680.   E int doversion();
  681. + /* ### vmsmain.c ### */
  682. + #ifdef VMS
  683. + #ifdef CHDIR
  684. + E void chdirx P((char *,char));
  685. + #endif /* CHDIR */
  686. + E void glo P((int));
  687. + E void askname();
  688. + #endif /* VMS */
  689. + /* ### vmsmisc.c ### */
  690. + #ifdef VMS
  691. + E void vms_abort();
  692. + E void vms_exit();
  693. + #endif /* VMS */
  694. + /* ### vmstty.c ### */
  695. + #ifdef VMS
  696. + E void gettty();
  697. + E void settty P((char *));
  698. + E void setftty();
  699. + E void intron();
  700. + E void introff();
  701. + E void error V((char *,...));
  702. + #endif /* VMS */
  703. + /* ### vmsunix.c ### */
  704. + #ifdef VMS
  705. + E void setrandom();
  706. + E int getyear();
  707. + E char *getdate();
  708. + E int phase_of_the_moon();
  709. + E int night();
  710. + E int midnight();
  711. + E void gethdate P((char *));
  712. + E int uptodate P((int));
  713. + E void getlock();
  714. + E void regularize P((char *));
  715. + E int vms_creat P((char *,unsigned int));
  716. + E int vms_getuid();
  717. + E void privoff();
  718. + E void privon();
  719. + # ifdef SHELL
  720. + E int dosh();
  721. + # endif
  722. + #endif /* VMS */
  723.   
  724.   /* ### weapon.c ### */
  725.   
  726. *** include/Old/flag.h    Wed Sep 27 13:11:28 1989
  727. --- include/flag.h    Thu Sep 14 14:46:21 1989
  728. ***************
  729. *** 51,56 ****
  730. --- 51,59 ----
  731.       boolean  silent;    /* whether the bell rings or not */
  732.       boolean  pickup;    /* whether you pickup or move and look */
  733.       boolean  num_pad;    /* use numbers for movement commands */
  734. + #ifdef TEXTCOLOR
  735. +     boolean  use_color;    /* use color grapics */
  736. + #endif
  737.   #ifdef DGK
  738.       boolean  IBMBIOS;    /* whether we can use a BIOS call for
  739.                    * redrawing the screen and character input */
  740. *** include/Old/global.h    Wed Sep 27 13:11:49 1989
  741. --- include/global.h    Mon Sep 25 20:55:26 1989
  742. ***************
  743. *** 9,15 ****
  744.   
  745.   
  746.   /* #define BETA        /* if a beta-test copy  [MRS] */
  747. ! #define VERSION    "3.0f"    /* version number. */
  748.   
  749.   /*
  750.    * Files expected to exist in the playground directory.
  751. --- 9,15 ----
  752.   
  753.   
  754.   /* #define BETA        /* if a beta-test copy  [MRS] */
  755. ! #define VERSION    "3.0g"    /* version number. */
  756.   
  757.   /*
  758.    * Files expected to exist in the playground directory.
  759. ***************
  760. *** 117,122 ****
  761. --- 117,127 ----
  762.   #ifndef COORD_H
  763.   #include "coord.h"
  764.   #endif
  765. + #if defined(VMS) && !defined(VMSCONF_H)
  766. + # include "vmsconf.h"
  767. + #endif
  768.   #if defined(UNIX) && !defined(UNIXCONF_H)
  769.   # include "unixconf.h"
  770.   #endif
  771. *** include/Old/monst.h    Wed Sep 27 13:13:23 1989
  772. --- include/monst.h    Thu Sep 14 14:24:49 1989
  773. ***************
  774. *** 68,74 ****
  775.   
  776.   #define newmonst(xl)    (struct monst *) alloc((unsigned)(xl) + sizeof(struct monst))
  777.   
  778. - extern struct monst *fmon;
  779.   extern struct monst *mydogs, *fallen_down;
  780.   
  781.   /* these are in mspeed */
  782. --- 68,73 ----
  783. *** include/Old/obj.h    Wed Sep 27 13:13:52 1989
  784. --- include/obj.h    Sat Sep 23 01:27:18 1989
  785. ***************
  786. *** 7,12 ****
  787. --- 7,13 ----
  788.   
  789.   struct obj {
  790.       struct obj *nobj;
  791. +     struct obj *nexthere;        /* for location lists */
  792.       struct obj *cobj;        /* id of container object is in */
  793.   /*    unsigned o_cwt;            /* container weight capacity */
  794.       unsigned o_id;
  795. ***************
  796. *** 45,54 ****
  797.       Bitfield(onamelth,6);
  798.       long age;        /* creation date */
  799.       long owornmask;
  800.   
  801.   /* note that TIMEOUT in you.h is defined as 07777L; no bits for items that
  802. !  * confer properties may overlap that mask, or timeout.c will happily rearrange
  803. !  * the bits behind the back of the property code
  804.    * shirts, balls, and chains are currently safe
  805.    */
  806.   #define    W_BALL    02000L
  807. --- 46,56 ----
  808.       Bitfield(onamelth,6);
  809.       long age;        /* creation date */
  810.       long owornmask;
  811. + #define oeaten        rustfree
  812.   
  813.   /* note that TIMEOUT in you.h is defined as 07777L; no bits for items that
  814. !  * confer properties may overlap that mask, or timeout.c will happily 
  815. !  * rearrange the bits behind the back of the property code
  816.    * shirts, balls, and chains are currently safe
  817.    */
  818.   #define    W_BALL    02000L
  819. ***************
  820. *** 75,88 ****
  821.                      is flexible; amount for tmp gold objects */
  822.   };
  823.   
  824. - extern struct obj *fobj;
  825.   #define newobj(xl)    (struct obj *) alloc((unsigned)(xl) + sizeof(struct obj))
  826.   #define    ONAME(otmp)    ((char *) otmp->oextra)
  827.   #define    OGOLD(otmp)    (otmp->oextra[0])
  828.   
  829.   # ifndef STUPID_CPP    /* otherwise these macros are functions */
  830. - /* #define OBJ_AT(x,y)    (levl[x][y].omask) */
  831.   
  832.   #define Is_container(otmp)    (otmp->otyp >= ICE_BOX && otmp->otyp <= BAG_OF_TRICKS)
  833.   #define Is_box(otmp)    (otmp->otyp == LARGE_BOX || otmp->otyp == CHEST)
  834. --- 77,88 ----
  835.                      is flexible; amount for tmp gold objects */
  836.   };
  837.   
  838.   #define newobj(xl)    (struct obj *) alloc((unsigned)(xl) + sizeof(struct obj))
  839.   #define    ONAME(otmp)    ((char *) otmp->oextra)
  840.   #define    OGOLD(otmp)    (otmp->oextra[0])
  841. + #define    OEATEN(otmp)    (otmp->oeaten)
  842.   
  843.   # ifndef STUPID_CPP    /* otherwise these macros are functions */
  844.   
  845.   #define Is_container(otmp)    (otmp->otyp >= ICE_BOX && otmp->otyp <= BAG_OF_TRICKS)
  846.   #define Is_box(otmp)    (otmp->otyp == LARGE_BOX || otmp->otyp == CHEST)
  847. *** include/Old/objclass.h    Wed Sep 27 13:14:06 1989
  848. --- include/objclass.h    Thu Sep 14 14:53:21 1989
  849. ***************
  850. *** 13,18 ****
  851. --- 13,22 ----
  852.       char *oc_uname;        /* called by user */
  853.       Bitfield(oc_name_known,1);
  854.       Bitfield(oc_merge,1);    /* merge otherwise equal objects */
  855. +     Bitfield(oc_uses_known,1); /* obj->known affects full decription */
  856. +                 /* otherwise, obj->dknown and obj->bknown */
  857. +                 /* tell all, and obj->known should always */
  858. +                 /* be set for proper merging behavior */
  859.       Bitfield(oc_bool,1);
  860.   #define oc_bimanual    oc_bool    /* for weapons */
  861.   #define oc_bulky    oc_bool    /* for armor */
  862. ***************
  863. *** 35,40 ****
  864. --- 39,47 ----
  865.       int oc_cost;        /* base cost in shops */
  866.       schar oc_oc1, oc_oc2;
  867.       int oc_oi;
  868. + #ifdef TEXTCOLOR
  869. +     uchar oc_color;        /* color of the object */
  870. + #endif /* TEXTCOLOR */
  871.   #define    nutrition    oc_oi    /* for foods */
  872.   #define w_propellor    oc_oi    /* for weapons */
  873.   #define WP_BOW        1
  874. *** include/Old/patchlevel.h    Wed Sep 27 13:14:18 1989
  875. --- include/patchlevel.h    Wed Sep 27 13:08:27 1989
  876. ***************
  877. *** 17,27 ****
  878. --- 17,29 ----
  879.    *  add better screen-size sensing
  880.    *  expand color use for PCs and introduce it for SVR3 UNIX machines
  881.    *  extend '/' to multiple identifications
  882. +  *  allow meta key to be used to invoke extended commands
  883.    *  fix various minor bugs, and do further code cleaning
  884.    */
  885.   
  886.   /*
  887.    *  Patch 3, September 6, 1989
  888. +  *  add war hammers and revise object prices
  889.    *  extend prototypes to ANSI compilers in addition to the previous MSDOS ones
  890.    *  move object-on-floor references into functions in preparation for planned
  891.    *    data structures to allow faster access and better colors
  892. ***************
  893. *** 29,32 ****
  894.    *    patches
  895.    */
  896.   
  897. ! #define PATCHLEVEL    3
  898. --- 31,46 ----
  899.    *    patches
  900.    */
  901.   
  902. ! /*
  903. !  *  Patch 4, September 27, 1989
  904. !  *  add support for VMS (courtesy David Gentzel)
  905. !  *  move monster-on-floor references into functions and implement the new
  906. !  *    lookup structure for both objects and monsters
  907. !  *  extend the definitions of objects and monsters to provide "living color"
  908. !  *    in the dungeon, instead of a single monster color
  909. !  *  ifdef varargs usage to satisfy ANSI compilers
  910. !  *  standardize on the color 'gray'
  911. !  *  assorted bug fixes
  912. !  */
  913. ! #define PATCHLEVEL    4
  914. *** include/Old/pcconf.h    Wed Sep  6 23:46:25 1989
  915. --- include/pcconf.h    Tue Sep 19 01:14:13 1989
  916. ***************
  917. *** 93,107
  918.   #  define TEXTCOLOR /* */
  919.   #endif
  920.   
  921. ! #ifdef TEXTCOLOR
  922. ! /* configurable colors */
  923. ! #  define HI_MON    RED    /* red slaps! */
  924. ! #  define HI_OBJ    MAGENTA
  925. ! #  define HI_METAL    CYAN
  926. ! #  define HI_ORGANIC    GREEN
  927. ! #  define HI_GOLD    YELLOW
  928. ! #  define HI_ZAP    BLUE    /* blue zaps! */
  929. ! #endif
  930. ! #endif
  931.   #endif /* MSDOS /* */
  932.  
  933. --- 93,97 -----
  934.   #  define TEXTCOLOR /* */
  935.   #endif
  936.   
  937. ! #endif /* PCCONF_H /* */
  938.   #endif /* MSDOS /* */
  939. *** include/Old/permonst.h    Wed Sep 27 13:14:41 1989
  940. --- include/permonst.h    Thu Sep 14 14:49:22 1989
  941. ***************
  942. *** 46,51 ****
  943. --- 46,54 ----
  944.       uchar        msound;            /* noise it makes */
  945.       long        mflags1,        /* boolean bitflags */
  946.               mflags2;        /* more boolean bitflags */
  947. + # ifdef TEXTCOLOR
  948. +     uchar        mcolor;            /* color to use */
  949. + # endif
  950.   };
  951.   
  952.   extern struct permonst mons[];        /* the master list of monster types */
  953. *** include/Old/rm.h    Wed Sep 27 13:15:00 1989
  954. --- include/rm.h    Fri Sep 15 11:45:15 1989
  955. ***************
  956. *** 206,213 ****
  957.       Bitfield(seen,1);
  958.       Bitfield(lit,1);
  959.       Bitfield(doormask,5);
  960. -     Bitfield(mmask,1);
  961. -     Bitfield(omask,1);
  962.       Bitfield(gmask,1);
  963.   };
  964.   
  965. --- 206,211 ----
  966. ***************
  967. *** 216,222 ****
  968.   #define ladder        doormask
  969.   #define drawbridgemask    doormask
  970.   
  971. ! extern struct rm levl[COLNO][ROWNO];
  972.   
  973.   #if defined(DGK) && !defined(OLD_TOS)
  974.   #define ACTIVE    1
  975. --- 214,249 ----
  976.   #define ladder        doormask
  977.   #define drawbridgemask    doormask
  978.   
  979. ! typedef struct
  980. ! {
  981. !     struct rm        locations[COLNO][ROWNO];
  982. !     struct obj        *objects[COLNO][ROWNO];
  983. !     struct monst    *monsters[COLNO][ROWNO];
  984. !     struct obj        *objlist;
  985. !     struct monst    *monlist;
  986. ! }
  987. ! level_t;
  988. ! extern level_t    level;    /* structure describing the current level */
  989. ! /*
  990. !  * Macros for compatibility with old code. Someday these will go away.
  991. !  */
  992. ! #define OBJ_AT(x, y)    (level.objects[x][y] != (struct obj *)0)
  993. ! #define MON_AT(x, y)    (level.monsters[x][y] != (struct monst *)0)
  994. ! #define levl        level.locations
  995. ! #define fobj        level.objlist
  996. ! #define fmon        level.monlist
  997. ! #ifndef STUPID_CPP    /* otherwise these macros are functions in monmove.c */
  998. ! /*
  999. !  * Macros for encapsulation of level.monsters references.
  1000. !  */
  1001. ! #define place_monster(m, x, y)    level.monsters[m->mx=x][m->my=y] = m
  1002. ! #define place_worm_seg(m, x, y) level.monsters[x][y] = m
  1003. ! #define remove_monster(x, y)    level.monsters[x][y] = (struct monst *)0
  1004. ! #define m_at(x, y)        level.monsters[x][y]
  1005. ! #endif    /* STUPID_CPP */
  1006.   
  1007.   #if defined(DGK) && !defined(OLD_TOS)
  1008.   #define ACTIVE    1
  1009. *** include/Old/system.h    Wed Sep 27 13:15:31 1989
  1010. --- include/system.h    Sun Sep 17 14:26:28 1989
  1011. ***************
  1012. *** 37,42 ****
  1013. --- 37,46 ----
  1014.   # endif
  1015.   #endif
  1016.   
  1017. + #ifdef VMS
  1018. + # define off_t long
  1019. + #endif
  1020.   /* You may want to change this to fit your system, as this is almost
  1021.    * impossible to get right automatically.
  1022.    * This is the type of signal handling functions.
  1023. ***************
  1024. *** 170,179 ****
  1025. --- 174,199 ----
  1026.   #endif
  1027.   #endif
  1028.   
  1029. + #ifdef NEED_VARARGS
  1030. + #if defined(USE_STDARG) || defined(USE_VARARGS)
  1031. + E int vsprintf P((char *, const char *, va_list));
  1032. + E int vprintf P((const char *, va_list));
  1033. + #else
  1034. + #   define vprintf        printf
  1035. + #   define vsprintf        sprintf
  1036. + #   define vpline        pline
  1037. + #endif
  1038. + #endif /* NEED_VARARGS */
  1039.   #define Sprintf    (void) sprintf
  1040.   #define Strcat    (void) strcat
  1041.   #define Strcpy    (void) strcpy
  1042.   #define Printf  (void) printf
  1043. + #ifdef NEED_VARARGS
  1044. + #define Vprintf (void) vprintf
  1045. + #define Vsprintf (void) vsprintf
  1046. + #endif
  1047.   
  1048.   E int tgetent P((char *,char *));
  1049.   E int tgetnum P((char *));
  1050. *** include/Old/tosconf.h    Wed Sep 27 13:15:45 1989
  1051. --- include/tosconf.h    Thu Sep 14 14:46:25 1989
  1052. ***************
  1053. *** 33,41 ****
  1054. --- 33,43 ----
  1055.   #define Srand() srand()
  1056.   #endif
  1057.   
  1058. + /* configurable options */
  1059.   #define DGK
  1060.   #define RANDOM
  1061.   #define SHELL
  1062. + #define TEXTCOLOR
  1063.   
  1064.   #ifndef MSDOS_H
  1065.   #include "msdos.h"
  1066. *** include/Old/tradstdc.h    Wed Sep 27 13:15:56 1989
  1067. --- include/tradstdc.h    Sun Sep 17 14:26:33 1989
  1068. ***************
  1069. *** 15,20 ****
  1070. --- 15,76 ----
  1071.    * Makes substitutes for compatibility with the old C standard.
  1072.    */
  1073.   
  1074. + /* Decide how to handle variable parameter lists:
  1075. +  * USE_STDARG means use the ANSI <stdarg.h> facilities (only ANSI compilers
  1076. +  * should do this, and only if the library supports it).
  1077. +  * USE_VARARGS means use the <varargs.h> facilities. Again, this should only
  1078. +  * be done if the library supports it. ANSI is *not* required for this.
  1079. +  * Otherwise, the kludgy old methods are used.
  1080. +  * The defaults are USE_STDARG for ANSI compilers, and USE_OLDARGS for
  1081. +  * others.
  1082. +  */
  1083. + /* #define USE_VARARGS        /* use <varargs.h> instead of <stdarg.h> */
  1084. + /* #define USE_OLDARGS        /* don't use any variable argument facilites */
  1085. + #ifdef __STDC__
  1086. + # if !(defined(AMIGA) || defined(USE_VARARGS) || defined(USE_OLDARGS))
  1087. + #   define USE_STDARG
  1088. + # endif
  1089. + #endif
  1090. + #ifdef NEED_VARARGS        /* only define these if necessary */
  1091. + #ifdef USE_STDARG
  1092. + # include <stdarg.h>
  1093. + # define VA_DECL(typ1,var1)    (typ1 var1, ...) { va_list the_args;
  1094. + # define VA_DECL2(typ1,var1,typ2,var2)    \
  1095. +     (typ1 var1, typ2 var2, ...) { va_list the_args;
  1096. + # define VA_INIT(var1,typ1)
  1097. + # define VA_NEXT(var1,typ1)    var1 = va_arg(the_args, typ1)
  1098. + # define VA_ARGS        the_args
  1099. + # define VA_START(x)        va_start(the_args, x)
  1100. + # define VA_END()        va_end(the_args)
  1101. + #else
  1102. + # ifdef USE_VARARGS
  1103. + #  include <varargs.h>
  1104. + #  define VA_DECL(typ1,var1)    (va_alist) va_dcl {\
  1105. +         va_list the_args; typ1 var1;
  1106. + #  define VA_DECL2(typ1,var1,typ2,var2)    (va_alist) va_dcl {\
  1107. +         va_list the_args; typ1 var1; typ2 var2;
  1108. + #  define VA_ARGS        the_args
  1109. + #  define VA_START(x)        va_start(the_args)
  1110. + #  define VA_INIT(var1,typ1)     va_arg(var1, typ1)
  1111. + #  define VA_NEXT(var1,typ1)    var1 = va_arg(the_args,typ1)
  1112. + #  define VA_END()        va_end(the_args)
  1113. + # else
  1114. + #   define VA_ARGS    arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9
  1115. + #   define VA_DECL(typ1,var1)  (var1,VA_ARGS) typ1 var1; \
  1116. +     char *arg1,*arg2,*arg3,*arg4,*arg5,*arg6,*arg7,*arg8,*arg9; {
  1117. + #   define VA_DECL2(typ1,var1,typ2,var2)  (var1,var2,VA_ARGS) \
  1118. +     typ1 var1; typ2 var2;\
  1119. +     char *arg1,*arg2,*arg3,*arg4,*arg5,*arg6,*arg7,*arg8,*arg9; {
  1120. + #   define VA_START(x)
  1121. + #   define VA_INIT(var1,typ1)
  1122. + #   define VA_END()
  1123. + # endif
  1124. + #endif
  1125. + #endif /* NEED_VARARGS */
  1126.   #if (defined(__STDC__) || defined(MSDOS)) && !defined(AMIGA)
  1127.   
  1128.   /* Used for robust ANSI parameter forward declarations:
  1129. ***************
  1130. *** 27,33 ****
  1131.    */
  1132.   
  1133.   # define P(s)        s
  1134. ! # ifdef MSDOS
  1135.   #  define V(s)        s
  1136.   # else
  1137.   #  define V(s)        ()
  1138. --- 83,89 ----
  1139.    */
  1140.   
  1141.   # define P(s)        s
  1142. ! # if defined(MSDOS) || defined(USE_STDARG)
  1143.   #  define V(s)        s
  1144.   # else
  1145.   #  define V(s)        ()
  1146. *** include/Old/unixconf.h    Wed Sep  6 23:47:19 1989
  1147. --- include/unixconf.h    Sat Sep 16 23:12:56 1989
  1148. ***************
  1149. *** 73,80
  1150.    * A stat system call is done on the mailbox every MAILCKFREQ moves.
  1151.    */
  1152.   
  1153. ! #define    MAIL
  1154. ! #if defined(BSD) || defined(ULTRIX)
  1155.   #define    DEF_MAILREADER    "/usr/ucb/Mail"
  1156.   #else
  1157.   # ifdef SYSV
  1158.  
  1159. --- 73,82 -----
  1160.    * A stat system call is done on the mailbox every MAILCKFREQ moves.
  1161.    */
  1162.   
  1163. ! #define    MAIL        /* Deliver mail during the game */
  1164. ! #ifdef MAIL
  1165. ! # if defined(BSD) || defined(ULTRIX)
  1166.   #define    DEF_MAILREADER    "/usr/ucb/Mail"
  1167.   # else
  1168.   #  if defined(SYSV) || defined(DGUX)
  1169. ***************
  1170. *** 76,84
  1171.   #define    MAIL
  1172.   #if defined(BSD) || defined(ULTRIX)
  1173.   #define    DEF_MAILREADER    "/usr/ucb/Mail"
  1174. - #else
  1175. - # ifdef SYSV
  1176. - #define    DEF_MAILREADER    "/usr/bin/mailx"
  1177.   # else
  1178.   #define    DEF_MAILREADER    "/bin/mail"
  1179.   # endif
  1180.  
  1181. --- 78,83 -----
  1182.   
  1183.   # if defined(BSD) || defined(ULTRIX)
  1184.   #define    DEF_MAILREADER    "/usr/ucb/Mail"
  1185.   # else
  1186.   #  if defined(SYSV) || defined(DGUX)
  1187.   #   ifdef M_XENIX
  1188. ***************
  1189. *** 80,85
  1190.   # ifdef SYSV
  1191.   #define    DEF_MAILREADER    "/usr/bin/mailx"
  1192.   # else
  1193.   #define    DEF_MAILREADER    "/bin/mail"
  1194.   # endif
  1195.   #endif
  1196.  
  1197. --- 79,91 -----
  1198.   # if defined(BSD) || defined(ULTRIX)
  1199.   #define    DEF_MAILREADER    "/usr/ucb/Mail"
  1200.   # else
  1201. + #  if defined(SYSV) || defined(DGUX)
  1202. + #   ifdef M_XENIX
  1203. + #define    DEF_MAILREADER    "/usr/bin/mail"
  1204. + #   else
  1205. + #define    DEF_MAILREADER    "/usr/bin/mailx"
  1206. + #   endif
  1207. + #  else
  1208.   #define    DEF_MAILREADER    "/bin/mail"
  1209.   #  endif
  1210.   # endif
  1211. ***************
  1212. *** 81,86
  1213.   #define    DEF_MAILREADER    "/usr/bin/mailx"
  1214.   # else
  1215.   #define    DEF_MAILREADER    "/bin/mail"
  1216.   # endif
  1217.   #endif
  1218.   #define    MAILCKFREQ    50
  1219.  
  1220. --- 87,93 -----
  1221.   #   endif
  1222.   #  else
  1223.   #define    DEF_MAILREADER    "/bin/mail"
  1224. + #  endif
  1225.   # endif
  1226.   
  1227.   #define    MAILCKFREQ    50
  1228. ***************
  1229. *** 82,88
  1230.   # else
  1231.   #define    DEF_MAILREADER    "/bin/mail"
  1232.   # endif
  1233. ! #endif
  1234.   #define    MAILCKFREQ    50
  1235.   
  1236.   #ifdef COMPRESS
  1237.  
  1238. --- 89,95 -----
  1239.   #define    DEF_MAILREADER    "/bin/mail"
  1240.   #  endif
  1241.   # endif
  1242.   #define    MAILCKFREQ    50
  1243.   #endif    /* MAIL */
  1244.   
  1245. ***************
  1246. *** 84,89
  1247.   # endif
  1248.   #endif
  1249.   #define    MAILCKFREQ    50
  1250.   
  1251.   #ifdef COMPRESS
  1252.   /* Some implementations of compress need a 'quiet' option.
  1253.  
  1254. --- 91,97 -----
  1255.   # endif
  1256.   
  1257.   #define    MAILCKFREQ    50
  1258. + #endif    /* MAIL */
  1259.   
  1260.   #ifdef COMPRESS
  1261.   /* Some implementations of compress need a 'quiet' option.
  1262. ***************
  1263. *** 146,160
  1264.   # undef hc
  1265.   #endif
  1266.   
  1267. ! #ifdef TEXTCOLOR
  1268. ! /* configurable colors */
  1269. ! #  define HI_MON    RED    /* red slaps! */
  1270. ! #  define HI_OBJ    MAGENTA
  1271. ! #  define HI_METAL    CYAN
  1272. ! #  define HI_ORGANIC    GREEN
  1273. ! #  define HI_GOLD    YELLOW
  1274. ! #  define HI_ZAP    BLUE    /* blue zaps! */
  1275. ! #endif
  1276. ! #endif
  1277.   #endif /* UNIX /* */
  1278.  
  1279. --- 154,158 -----
  1280.   # undef hc
  1281.   #endif
  1282.   
  1283. ! #endif /* UNIXCONF_H /* */
  1284.   #endif /* UNIX /* */
  1285. *** ./Old/Install.unix    Wed Sep 27 10:11:25 1989
  1286. --- ./Install.unix    Sat Sep 23 00:47:12 1989
  1287. ***************
  1288. *** 49,64 ****
  1289.   
  1290.   Notes:
  1291.   
  1292. ! 1.  No, your old save files and bones files will not work with NetHack 3.0.
  1293.       Don't bother trying to keep them.  The old score list will work fine; the
  1294.       only problem is that you may have trouble beating your old scores in this
  1295.       version.
  1296.   
  1297. ! 2.  If you insisted on doing the final installation by hand, you probably
  1298.       forgot to make a save directory.  If you don't go back and do this, you
  1299.       won't be able to save games.
  1300.   
  1301. ! 3.  To install an update of this version of NetHack after changing something,
  1302.       type 'make update' from the main directory.  If you created the new
  1303.       version yourself, it should be safe to use 'make update' as long as you
  1304.       did not add, delete, or reorder monsters or objects and you did not change
  1305. --- 49,70 ----
  1306.   
  1307.   Notes:
  1308.   
  1309. ! 1.  A number of systems, such as Xenix, support both the termcap and terminfo
  1310. !     terminal capability libraries.  Make sure that the TERMINFO definition in
  1311. !     unixconf.h and TERMLIB in the source Makefile correspond.
  1312. !     If spurious characters appear on the screen while kicking, zapping, etc.
  1313. !     it is likely that you have linked the source to the wrong library.
  1314. ! 2.  No, your old save files and bones files will not work with NetHack 3.0.
  1315.       Don't bother trying to keep them.  The old score list will work fine; the
  1316.       only problem is that you may have trouble beating your old scores in this
  1317.       version.
  1318.   
  1319. ! 3.  If you insisted on doing the final installation by hand, you probably
  1320.       forgot to make a save directory.  If you don't go back and do this, you
  1321.       won't be able to save games.
  1322.   
  1323. ! 4.  To install an update of this version of NetHack after changing something,
  1324.       type 'make update' from the main directory.  If you created the new
  1325.       version yourself, it should be safe to use 'make update' as long as you
  1326.       did not add, delete, or reorder monsters or objects and you did not change
  1327. ***************
  1328. *** 65,67 ****
  1329. --- 71,81 ----
  1330.       the format of saved level files.  If you did any of these things, you
  1331.       should also remove any saved games and bones levels.  (Trying to use such
  1332.       files often produces amusing but useless confusions on the game's part.)
  1333. + 5.  Xenix/286's lex generates a faulty lexical analyser from lev_comp.l.
  1334. +     The beta-release of flex 2.1 (avaliable from uunet, osu-cis,
  1335. +     prep.ai.mit.edu, etc.) can be used to generate the lexer.
  1336. +     The only change to flex is to change "#define yyleng (yy_cp - yy_bp)"
  1337. +     to "#define yyleng (int)(yy_cp - yy_bp)" in flex.skel.
  1338. +     Flex is not needed with Xenix/386, as its lex generates a proper lexical
  1339. +     analyser.  [Xenix instructions by J.T. Conklin]
  1340. *** ./Old/Makefile.top    Wed Sep 27 10:11:38 1989
  1341. --- ./Makefile.top    Tue Sep 19 18:52:15 1989
  1342. ***************
  1343. *** 1,6 ****
  1344. --- 1,18 ----
  1345.   #    Hack Makefile.
  1346.   #    SCCS Id: @(#)Makefile.top    3.0    89/03/23
  1347.   
  1348. + # newer makes predefine $(MAKE) to 'make' and do smarter processing of
  1349. + # recursive make calls if $(MAKE) is used
  1350. + # these makes allow $(MAKE) to be overridden by the environment if someone
  1351. + # wants to (or has to) use something other than the standard make, so we do
  1352. + # not want to unconditionally set $(MAKE) here
  1353. + #
  1354. + # unfortunately, some older makes do not predefine $(MAKE); if you have one of
  1355. + # these, uncomment the following line
  1356. + # (you will know that you have one if you get complaints about unable to
  1357. + # execute things like 'data' and 'rumors')
  1358. + # MAKE = make
  1359.   # make NetHack
  1360.   GAME     = nethack
  1361.   GAMEUID  = games
  1362. ***************
  1363. *** 55,60 ****
  1364. --- 67,73 ----
  1365.   #    (don't yank the old version out from under people who're playing it)
  1366.       mv $(GAMEDIR)/$(GAME) $(GAMEDIR)/$(GAME).old
  1367.       cp src/$(GAME) $(GAMEDIR)
  1368. +     -rm -f $(SHELLDIR)/$(GAME)
  1369.       sed -e 's;/usr/games/lib/nethackdir;$(GAMEDIR);' \
  1370.           -e 's;HACKDIR/nethack;HACKDIR/$(GAME);' \
  1371.           < auxil/nethack.sh \
  1372. ***************
  1373. *** 82,87 ****
  1374. --- 95,101 ----
  1375.   # copy over the game files
  1376.       ( cd auxil ; cp $(AUX) $(GAMEDIR) )
  1377.       cp src/$(GAME) $(GAMEDIR)
  1378. +     -rm -f $(SHELLDIR)/$(GAME)
  1379.       sed -e 's;/usr/games/lib/nethackdir;$(GAMEDIR);' \
  1380.           -e 's;HACKDIR/nethack;HACKDIR/$(GAME);' \
  1381.           < auxil/nethack.sh \
  1382. *** ./Old/Files    Wed Sep 27 10:11:03 1989
  1383. --- ./Files    Tue Sep 26 23:04:12 1989
  1384. ***************
  1385. *** 1,7 ****
  1386. ! This is a listing of all files in a full NetHack 3.0 distribution, organized in
  1387. ! their standard manner on a UNIX system.  It indicates which files are necessary
  1388. ! for which versions, so that you can tell which files may be deleted from or not
  1389. ! transferred to your system if you wish.
  1390.   
  1391.   
  1392.   (files in top directory)
  1393. --- 1,7 ----
  1394. ! This is a listing of all files in a full NetHack 3.0 distribution, organized
  1395. ! in their standard manner on a UNIX system.  It indicates which files are 
  1396. ! necessary for which versions, so that you can tell which files may be deleted
  1397. ! from or not transferred to your system if you wish.
  1398.   
  1399.   
  1400.   (files in top directory)
  1401. ***************
  1402. *** 27,34 ****
  1403.   
  1404.   others:
  1405.   (files for MSDOS version)
  1406. ! Make.ini        Makefile.msc    Makefile.os2    Makefile.tcc    Maketcc.ini
  1407. ! NetHack.cnf     termcap         termcap.uu
  1408.   (files for MSDOS, Amiga, and Atari versions)
  1409.   pcmain.c        pctty.c         pcunix.c
  1410.   (file for MSDOS and new Atari versions)
  1411. --- 27,34 ----
  1412.   
  1413.   others:
  1414.   (files for MSDOS version)
  1415. ! Make.ini        Makefile.msc    Makefile.pc     Makefile.os2    Makefile.tcc
  1416. ! Maketcc.ini     NetHack.cnf     termcap         termcap.uu
  1417.   (files for MSDOS, Amiga, and Atari versions)
  1418.   pcmain.c        pctty.c         pcunix.c
  1419.   (file for MSDOS and new Atari versions)
  1420. ***************
  1421. *** 37,43 ****
  1422.   Makefile.st
  1423.   (file for old Atari version)
  1424.   oldtos.c
  1425. ! (file with random number routines, which may be included in any version)
  1426.   random.c
  1427.   
  1428.   
  1429. --- 37,43 ----
  1430.   Makefile.st
  1431.   (file for old Atari version)
  1432.   oldtos.c
  1433. ! (Berkeley random number file, which may be included in any version)
  1434.   random.c
  1435.   
  1436.   
  1437. ***************
  1438. *** 51,57 ****
  1439.   obj.h           objclass.h      patchlevel.h    pcconf.h        permonst.h
  1440.   prop.h          rm.h            sp_lev.h        spell.h         system.h
  1441.   tosconf.h       tradstdc.h      trap.h          trapname.h      unixconf.h
  1442. ! vault.h         wseg.h          you.h           youprop.h
  1443.   (file for special level compiler (STRONGHOLD option))
  1444.   lev_comp.h
  1445.   
  1446. --- 51,57 ----
  1447.   obj.h           objclass.h      patchlevel.h    pcconf.h        permonst.h
  1448.   prop.h          rm.h            sp_lev.h        spell.h         system.h
  1449.   tosconf.h       tradstdc.h      trap.h          trapname.h      unixconf.h
  1450. ! vault.h         vmsconf.h       wseg.h          you.h           youprop.h
  1451.   (file for special level compiler (STRONGHOLD option))
  1452.   lev_comp.h
  1453.   
  1454. ***************
  1455. *** 79,81 ****
  1456. --- 79,88 ----
  1457.   lev_comp.c      lev_comp.l      lev_comp.y      lev_lex.c       lev_main.c
  1458.   (files for UNIX versions)
  1459.   Makefile.src    unixmain.c      unixtty.c       unixunix.c
  1460. + vms:
  1461. + (files for VMS version)
  1462. + Install.vms     spec_lev.com    vmsbuild.com    vmsmain.c       vmsmisc.c
  1463. + vmstty.c        vmsunix.c
  1464. + (GNU termcap files that support VMS version)
  1465. + vmstermcap.c    vmstparam.c
  1466. *** ./Old/README    Wed Sep 27 10:11:59 1989
  1467. --- ./README    Sun Sep 17 13:12:06 1989
  1468. ***************
  1469. *** 37,43 ****
  1470.       directory as the 'Top' directory.  It makes no difference what you
  1471.       call it.
  1472.   
  1473. ! 2.  If there is no flaw in the packaging, FIVE sub-directories will be
  1474.       automatically created, and files will be deposited in them: 
  1475.   
  1476.       a.  A 'src' directory, which will contain general *.c files.
  1477. --- 37,43 ----
  1478.       directory as the 'Top' directory.  It makes no difference what you
  1479.       call it.
  1480.   
  1481. ! 2.  If there is no flaw in the packaging, SIX sub-directories will be
  1482.       automatically created, and files will be deposited in them: 
  1483.   
  1484.       a.  A 'src' directory, which will contain general *.c files.
  1485. ***************
  1486. *** 45,50 ****
  1487. --- 45,51 ----
  1488.       c.  An 'auxil' directory, which will contain a variety of data files.
  1489.       d.  An 'amiga' directory, which will contain the Amiga-specific files.
  1490.       e.  An 'others' directory, which will contain MSDOS and TOS files.
  1491. +     f.  A 'vms' directory, which will contain VMS files.
  1492.   
  1493.       The names of these directories should not be changed, unless you are
  1494.       ready to go through the makefiles and the makedefs program and change
  1495. ***************
  1496. *** 86,91 ****
  1497. --- 87,94 ----
  1498.       Commodore Amiga (probably -- there have been some changes since
  1499.           the Amiga port was done, but we believe it should still work)
  1500.       Atari 1040ST under TOS
  1501. +     DEC vaxen running VMS (probably still requires tweaking) 
  1502. +     Data General AViiON systems under DG/UX
  1503.   
  1504.               - - - - - - - - - - -
  1505.   
  1506. *** /dev/null    Thu Sep 28 00:44:19 1989
  1507. --- include/vmsconf.h    Thu Sep 28 00:44:04 1989
  1508. ***************
  1509. *** 0
  1510.  
  1511. --- 1,69 -----
  1512. + /*    SCCS Id: @(#)vmsconf.h    3.0    88/07/21
  1513. + /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
  1514. + /* NetHack may be freely redistributed.  See license for details. */
  1515. + #ifdef VMS
  1516. + #ifndef VMSCONF_H
  1517. + #define VMSCONF_H
  1518. + #undef UNIX
  1519. + #undef HACKDIR
  1520. + #define HACKDIR    "USR$ROOT0:[GENTZEL.NHDIR]"
  1521. + #undef RECORD
  1522. + #define RECORD "record;1"
  1523. + #undef COMPRESS
  1524. + #undef ZEROCOMP
  1525. + /*
  1526. +  * If you define MAIL, then the player will be notified of new broadcasts
  1527. +  * when they arrive.
  1528. +  */
  1529. + #define    MAIL
  1530. + #define RANDOM        /* if neither random/srandom nor lrand48/srand48
  1531. +                is available from your system */
  1532. + #define    FCMASK    0660    /* file creation mask */
  1533. + /*
  1534. +  * The remainder of the file should not need to be changed.
  1535. +  */
  1536. + #include <time.h>
  1537. + #include <file.h>
  1538. + #define    HLOCK    "perm;1"    /* an empty file used for locking purposes */
  1539. + #define LLOCK    "safelock;1"    /* link to previous */
  1540. + #ifndef REDO
  1541. + # define Getchar vms_getchar
  1542. + #else
  1543. + # define tgetch vms_getchar
  1544. + #endif
  1545. + #define SHELL        /* do not delete the '!' command */
  1546. + #include "system.h"
  1547. + #define index    strchr
  1548. + #define rindex    strrchr
  1549. + /* Use the high quality random number routines. */
  1550. + #if defined(RANDOM)
  1551. + #define Rand()    random()
  1552. + #define Srand(seed) srandom(seed)
  1553. + #else
  1554. + #define Rand()    rand()
  1555. + #define Srand(seed) srand(seed)
  1556. + #endif
  1557. + #define unlink(x) delete(x)
  1558. + #define exit(x) vms_exit(x)
  1559. + #define getuid() vms_getuid()
  1560. + #define abort() vms_abort()
  1561. + #define creat(f,m) vms_creat(f,m)
  1562. + #endif
  1563. + #endif /* VMS /* */
  1564. *** /dev/null    Wed Sep 27 12:48:12 1989
  1565. --- vms/vmsunix.c    Tue Sep 26 18:51:29 1989
  1566. ***************
  1567. *** 0 ****
  1568. --- 1,397 ----
  1569. + /*    SCCS Id: @(#)vmsunix.c    3.0    88/04/13
  1570. + /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
  1571. + /* NetHack may be freely redistributed.  See license for details. */
  1572. + /* This file collects some Unix dependencies; pager.c contains some more */
  1573. + /*
  1574. +  * The time is used for:
  1575. +  *    - seed for rand()
  1576. +  *    - year on tombstone and yymmdd in record file
  1577. +  *    - phase of the moon (various monsters react to NEW_MOON or FULL_MOON)
  1578. +  *    - night and midnight (the undead are dangerous at midnight)
  1579. +  *    - determination of what files are "very old"
  1580. +  */
  1581. + #include "hack.h"
  1582. + #include <rms.h>
  1583. + #include <jpidef.h>
  1584. + #include <ssdef.h>
  1585. + #include <errno.h>
  1586. + #include <signal.h>
  1587. + #undef off_t
  1588. + #include <sys/stat.h>
  1589. + void
  1590. + setrandom()
  1591. + {
  1592. +     (void) Srand((long) time ((time_t *) 0));
  1593. + }
  1594. + static struct tm *
  1595. + getlt()
  1596. + {
  1597. +     time_t date;
  1598. +     (void) time(&date);
  1599. +     return(localtime(&date));
  1600. + }
  1601. + int
  1602. + getyear()
  1603. + {
  1604. +     return(1900 + getlt()->tm_year);
  1605. + }
  1606. + char *
  1607. + getdate()
  1608. + {
  1609. +     static char datestr[7];
  1610. +     register struct tm *lt = getlt();
  1611. +     Sprintf(datestr, "%2d%2d%2d",
  1612. +         lt->tm_year, lt->tm_mon + 1, lt->tm_mday);
  1613. +     if(datestr[2] == ' ') datestr[2] = '0';
  1614. +     if(datestr[4] == ' ') datestr[4] = '0';
  1615. +     return(datestr);
  1616. + }
  1617. + int
  1618. + phase_of_the_moon()            /* 0-7, with 0: new, 4: full */
  1619. + {                    /* moon period: 29.5306 days */
  1620. +                     /* year: 365.2422 days */
  1621. +     register struct tm *lt = getlt();
  1622. +     register int epact, diy, goldn;
  1623. +     diy = lt->tm_yday;
  1624. +     goldn = (lt->tm_year % 19) + 1;
  1625. +     epact = (11 * goldn + 18) % 30;
  1626. +     if ((epact == 25 && goldn > 11) || epact == 24)
  1627. +         epact++;
  1628. +     return( (((((diy + epact) * 6) + 11) % 177) / 22) & 7 );
  1629. + }
  1630. + int
  1631. + night()
  1632. + {
  1633. +     register int hour = getlt()->tm_hour;
  1634. +     return(hour < 6 || hour > 21);
  1635. + }
  1636. + int
  1637. + midnight()
  1638. + {
  1639. +     return(getlt()->tm_hour == 0);
  1640. + }
  1641. + static struct stat buf, hbuf;
  1642. + void
  1643. + gethdate(name) char *name; {
  1644. +     register char *np;
  1645. +     if(stat(name, &hbuf))
  1646. +         error("Cannot get status of %s.",
  1647. +             (np = rindex(name, ']')) ? np+1 : name);
  1648. + }
  1649. + int
  1650. + uptodate(fd)
  1651. + int fd;
  1652. + {
  1653. +     if(fstat(fd, &buf)) {
  1654. +         pline("Cannot get status of saved level? ");
  1655. +         return(0);
  1656. +     }
  1657. +     if(buf.st_mtime < hbuf.st_mtime) {
  1658. +         pline("Saved level is out of date. ");
  1659. +         return(0);
  1660. +     }
  1661. +     return(1);
  1662. + }
  1663. + static int
  1664. + veryold(fd)
  1665. + int fd;
  1666. + {
  1667. +     register int i;
  1668. +     time_t date;
  1669. +     if(fstat(fd, &buf)) return(0);            /* cannot get status */
  1670. +     if(buf.st_size != sizeof(int)) return(0);    /* not an xlock file */
  1671. +     (void) time(&date);
  1672. +     if(date - buf.st_mtime < 3L*24L*60L*60L) {    /* recent */
  1673. +         int lockedpid;    /* should be the same size as hackpid */
  1674. +         int status, dummy, code = JPI$_PID;
  1675. +         if(read(fd, (char *)&lockedpid, sizeof(lockedpid)) !=
  1676. +             sizeof(lockedpid))
  1677. +             /* strange ... */
  1678. +             return(0);
  1679. +           if(!(!((status = LIB$GETJPI(&code, &lockedpid, 0, &dummy)) & 1)
  1680. +              && status == SS$_NONEXPR))
  1681. +             return(0);
  1682. +     }
  1683. +     (void) close(fd);
  1684. +     for(i = 1; i <= MAXLEVEL+1; i++) {        /* try to remove all */
  1685. +         glo(i);
  1686. +         (void) delete(lock);
  1687. +     }
  1688. +     glo(0);
  1689. +     if(delete(lock)) return(0);            /* cannot remove it */
  1690. +     return(1);                    /* success! */
  1691. + }
  1692. + void
  1693. + getlock()
  1694. + {
  1695. +     register int i = 0, fd;
  1696. + #ifdef HARD
  1697. +     /* idea from rpick%ucqais@uccba.uc.edu
  1698. +      * prevent automated rerolling of characters
  1699. +      * test input (fd0) so that tee'ing output to get a screen dump still
  1700. +      * works
  1701. +      * also incidentally prevents development of any hack-o-matic programs
  1702. +      */
  1703. +     if (!isatty(0))
  1704. +         error("You must play from a terminal.");
  1705. + #endif
  1706. +     (void) fflush(stdout);
  1707. +     /* we ignore QUIT and INT at this point */
  1708. +     if (link(HLOCK, LLOCK) == -1) {
  1709. +         register int errnosv = errno;
  1710. +         perror(HLOCK);
  1711. +         Printf("Cannot link %s to %s\n", LLOCK, HLOCK);
  1712. +         switch(errnosv) {
  1713. +         case ENOENT:
  1714. +             Printf("Perhaps there is no (empty) file %s ?\n", HLOCK);
  1715. +             break;
  1716. +         case EACCES:
  1717. +             Printf("It seems you don't have write permission here.\n");
  1718. +             break;
  1719. +         case EEXIST:
  1720. +             Printf("(Try again or rm %s.)\n", LLOCK);
  1721. +             break;
  1722. +         default:
  1723. +             Printf("I don't know what is wrong.");
  1724. +         }
  1725. +         getret();
  1726. +         error("");
  1727. +         /*NOTREACHED*/
  1728. +     }
  1729. +     regularize(lock);
  1730. +     glo(0);
  1731. +     if(locknum > 25) locknum = 25;
  1732. +     do {
  1733. +         if(locknum) lock[0] = 'a' + i++;
  1734. +         if((fd = open(lock, 0)) == -1) {
  1735. +             if(errno == ENOENT) goto gotlock;    /* no such file */
  1736. +             perror(lock);
  1737. +             (void) delete(LLOCK);
  1738. +             error("Cannot open %s", lock);
  1739. +         }
  1740. +         if(veryold(fd))    /* if true, this closes fd and unlinks lock */
  1741. +             goto gotlock;
  1742. +         (void) close(fd);
  1743. +     } while(i < locknum);
  1744. +     (void) delete(LLOCK);
  1745. +     error(locknum ? "Too many hacks running now."
  1746. +               : "There is a game in progress under your name.");
  1747. + gotlock:
  1748. +     fd = creat(lock, FCMASK);
  1749. +     if(delete(LLOCK) == -1)
  1750. +         error("Cannot delete %s.", LLOCK);
  1751. +     if(fd == -1) {
  1752. +         error("cannot creat lock file.");
  1753. +     } else {
  1754. +         if(write(fd, (char *) &hackpid, sizeof(hackpid))
  1755. +             != sizeof(hackpid)){
  1756. +             error("cannot write lock");
  1757. +         }
  1758. +         if(close(fd) == -1) {
  1759. +             error("cannot close lock");
  1760. +         }
  1761. +     }
  1762. + }    
  1763. + void
  1764. + regularize(s)    /* normalize file name */
  1765. + register char *s;
  1766. + {
  1767. +     register char *lp;
  1768. +     for (lp = s; *lp; lp++)
  1769. +         if (!((*lp >= 'A' && *lp <= 'Z')
  1770. +               || (*lp >= 'a' && *lp <= 'z')
  1771. +               || (*lp >= '0' && *lp <= '9')
  1772. +               || *lp == '$' || *lp == '_'
  1773. +               || (lp > s && *lp == '-')))
  1774. +             *lp = '_';
  1775. + }
  1776. + int link(file, new)
  1777. + char *file, *new;
  1778. + {
  1779. +     int status;
  1780. +     struct FAB fab;
  1781. +     struct NAM nam;
  1782. +     unsigned short fid[3];
  1783. +     char esa[NAM$C_MAXRSS];
  1784. +     fab = cc$rms_fab;
  1785. +     fab.fab$l_fop = FAB$M_OFP;
  1786. +     fab.fab$l_fna = file;
  1787. +     fab.fab$b_fns = strlen(file);
  1788. +     fab.fab$l_nam = &nam;
  1789. +     nam = cc$rms_nam;
  1790. +     nam.nam$l_esa = esa;
  1791. +     nam.nam$b_ess = NAM$C_MAXRSS;
  1792. +     if (!((status = SYS$PARSE(&fab)) & 1)
  1793. +     || !((status = SYS$SEARCH(&fab)) & 1))
  1794. +     {
  1795. +     C$$TRANSLATE(status);
  1796. +     return -1;
  1797. +     }
  1798. +     fid[0] = nam.nam$w_fid[0];
  1799. +     fid[1] = nam.nam$w_fid[1];
  1800. +     fid[2] = nam.nam$w_fid[2];
  1801. +     fab.fab$l_fna = new;
  1802. +     fab.fab$b_fns = strlen(new);
  1803. +     if (!((status = SYS$PARSE(&fab)) & 1))
  1804. +     {
  1805. +     C$$TRANSLATE(status);
  1806. +     return -1;
  1807. +     }
  1808. +     nam.nam$w_fid[0] = fid[0];
  1809. +     nam.nam$w_fid[1] = fid[1];
  1810. +     nam.nam$w_fid[2] = fid[2];
  1811. +     nam.nam$l_esa = nam.nam$l_name;
  1812. +     nam.nam$b_esl = nam.nam$b_name + nam.nam$b_type + nam.nam$b_ver;
  1813. +     if (!((status = SYS$ENTER(&fab)) & 1))
  1814. +     {
  1815. +     C$$TRANSLATE(status);
  1816. +     return -1;
  1817. +     }
  1818. +     return 0;
  1819. + }
  1820. + #undef unlink
  1821. + int unlink(file)
  1822. + char *file;
  1823. + {
  1824. +     int status;
  1825. +     struct FAB fab = cc$rms_fab;
  1826. +     struct NAM nam = cc$rms_nam;
  1827. +     char esa[NAM$C_MAXRSS];
  1828. +     fab.fab$l_fop = FAB$M_DLT;
  1829. +     fab.fab$l_fna = file;
  1830. +     fab.fab$b_fns = strlen(file);
  1831. +     fab.fab$l_nam = &nam;
  1832. +     nam.nam$l_esa = esa;
  1833. +     nam.nam$b_ess = NAM$C_MAXRSS;
  1834. +     if (!((status = SYS$PARSE(&fab)) & 1)
  1835. +     || !((status = SYS$REMOVE(&fab)) & 1))
  1836. +     {
  1837. +     C$$TRANSLATE(status);
  1838. +     return -1;
  1839. +     }
  1840. +     return 0;
  1841. + }
  1842. + #undef creat
  1843. + int vms_creat(file, mode)
  1844. + char *file;
  1845. + unsigned int mode;
  1846. + {
  1847. +     if (index(file, ';'))
  1848. +     (void) delete(file);
  1849. +     return creat(file, mode);
  1850. + }
  1851. + #undef getuid
  1852. + int
  1853. + vms_getuid()
  1854. + {
  1855. +     return (getgid() << 16) | getuid();
  1856. + }
  1857. + #ifdef CHDIR
  1858. + unsigned int oprv[2];
  1859. + void
  1860. + privoff()
  1861. + {
  1862. +     unsigned int prv[2] = { -1, -1 }, code = JPI$_PROCPRIV;
  1863. +     (void) SYS$SETPRV(0, prv, 0, oprv);
  1864. +     (void) LIB$GETJPI(&code, 0, 0, prv);
  1865. +     (void) SYS$SETPRV(1, prv, 0, 0);
  1866. + }
  1867. + void
  1868. + privon()
  1869. + {
  1870. +     (void) SYS$SETPRV(1, oprv, 0, 0);
  1871. + }
  1872. + #endif
  1873. + #ifdef SHELL
  1874. + unsigned int dosh_pid = 0;
  1875. + int
  1876. + dosh()
  1877. + {
  1878. +     int status;
  1879. +     settty((char *) NULL);    /* also calls end_screen() */
  1880. +     (void) signal(SIGINT,SIG_IGN);
  1881. +     (void) signal(SIGQUIT,SIG_IGN);
  1882. +     if (!dosh_pid || !((status = LIB$ATTACH(&dosh_pid)) & 1))
  1883. +     {
  1884. + #ifdef CHDIR
  1885. +         (void) chdir(getenv("PATH"));
  1886. +         privoff();
  1887. + #endif
  1888. +         dosh_pid = 0;
  1889. +         status = LIB$SPAWN(0, 0, 0, 0, 0, &dosh_pid);
  1890. + #ifdef CHDIR
  1891. +         privon();
  1892. +         chdirx((char *) 0, 0);
  1893. + #endif
  1894. +     }
  1895. +     gettty();
  1896. +     setftty();
  1897. +     (void) signal(SIGINT, (SIG_RET_TYPE) done1);
  1898. + #ifdef WIZARD
  1899. +     if(wizard) (void) signal(SIGQUIT,SIG_DFL);
  1900. + #endif
  1901. +     docrt();
  1902. +     if (!(status & 1))
  1903. +         pline("Spawn failed.  Try again.");
  1904. +     return 0;
  1905. + }
  1906. + #endif
  1907.  
  1908.