[comp.sources.games] v12i078: cdungeon - C language port of DECUS dungeon, Part11/12

billr@saab.CNA.TEK.COM (Bill Randle) (05/15/91)

Submitted-by: ian@airs.COM
Posting-number: Volume 12, Issue 78
Archive-name: cdungeon/Part11
Environment: Unix, MS-DOS



#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of archive 11 (of 12)."
# Contents:  History actors.c dgame.c dso3.c dungeon.6 np1.c np2.c
#   supp.c
# Wrapped by billr@saab on Tue May 14 16:27:44 1991
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'History' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'History'\"
else
echo shar: Extracting \"'History'\" \(4816 characters\)
sed "s/^X//" >'History' <<'END_OF_FILE'
X	History of the C Implementation of Dungeon
X	==========================================
X
XThis version of dungeon has been modified from FORTRAN to C.  The
Xoriginal was written in DEC FORTRAN, translated from MDL.  It was then
Xtranslated to f77 for UN*X systems, from which it was translated to C.
XThe C translation was done with the help of f2c, the FORTRAN to C
Xtranslator written by David Gay (AT&T Bell Labs), Stu Feldman
X(Bellcore), Mark Maimone (Carnegie-Mellon University), and Norm
XSchryer (AT&T Bell Labs).
X
XI. From the original documentation...
X
XTo:	Dungeon Players
XFrom:	"The Translator"
XSubj:	Game Information
XDate:	8-OCT-80
X
X
XThis is the first (and last) source release of the PDP-11 version of 
XDungeon.
X
XPlease note that Dungeon has been superceded by the game ZORK(tm).
XThe following is an extract from the new product announcement for
XZORK in the September, 1980 issue of the RT-11 SIG newsletter:
X
X  "'ZORK:  The Great Underground Empire - Part I' ...was developed
X   by the original authors based on their ZORK (Dungeon) game for
X   the PDP-10.  It features a greatly improved parser;  command
X   input and transcript output files;  SAVEs to any device and
X   file name;  and adaptation to different terminal types,
X   including a status line on VT100s.  Note:  this is not the
X   FORTRAN version that has been available through DECUS.  This
X   version has been completely rewritten to run efficiently on
X   small machines - up to 10 times as fast as the DECUS version.
X
X   ...ZORK runs under RT-ll, HT-ll, or RSTS/E and requires as
X   little as 20K words of memory and a single floppy disk drive.
X   The game package, consisting of an RX01-format diskette and
X   an instruction booklet, is available from Infocom, Inc.,
X   P.O. Box 120, Kendall Station, Cambridge, Ma. 02142."
X
XZORK(tm) is a trademark of Infocom, Inc.  It is available for several
Xpopular personal computers as well as for the PDP-ll.
X
X
XSUMMARY
X-------
X
X		    Welcome to Dungeon!
X
X   Dungeon is a game of adventure, danger, and low cunning.  In it
Xyou will explore some of the most amazing territory ever seen by mortal
Xman.  Hardened adventurers have run screaming from the terrors contained
Xwithin.
X
X   In Dungeon, the intrepid explorer delves into the forgotten secrets
Xof a lost labyrinth deep in the bowels of the earth, searching for
Xvast treasures long hidden from prying eyes, treasures guarded by
Xfearsome monsters and diabolical traps!
X
X   No DECsystem should be without one!
X
X   Dungeon was created at the Programming Technology Division of the MIT
XLaboratory for Computer Science by Tim Anderson, Marc Blank, Bruce
XDaniels, and Dave Lebling.  It was inspired by the Adventure game of
XCrowther and Woods, and the Dungeons and Dragons game of Gygax
Xand Arneson.  The original version was written in MDL (alias MUDDLE).
XThe current version was translated from MDL into FORTRAN IV by
Xa somewhat paranoid DEC engineer who prefers to remain anonymous.
X
X   On-line information may be obtained with the commands HELP and INFO.
X
XII. DEC FORTRAN to f77 Conversion (17-nov-81)
X
XThe conversion from DEC FORTRAN to Unix f77 was done by Randy
XDietrich, Lynn Cochran and Sig Peterson.  Much hacking was done to get
Xit to fit in the limited address space of a PDP-11/44 (split I/D).
XSuffice it to say that by leaving out the debugging package and not
Xlinking in the f77 i/o library they managed to get it to run.
X
XIII. PDP to VAX (dec-85)
X
XBased on the work of Randy, Lynn and Sig, Bill Randle folded in the
Xfull save/restore functions and the game debugging package (gdt) into
Xthe pdp version to create a Vax/Unix version.  This version also uses
Xf77 i/o, thus eliminating the extra speak and listen processes needed
Xon the pdp.
X
XIV. Cleanup I (11-dec-86)
X
XJohn Gilmore (hoptoad!gnu) cleaned up the source files by moving
Xmost of the common declarations into include files and added
Xcomments from the original (FORTRAN or MDL?) source.  His efforts
Xare greatly appreciated.
X
XV. Cleanup II (9-feb-87)
X
XBill Randle (billr@tekred.tek.com) added the pdp dependencies back
Xinto the Vax source files with #ifdefs in order to have just one
Xset of sources.  Previously, there were two sets of source: one for
Xthe pdp and one for the Vax.  In addition, a shell escape of the
Xform !cmd was added and the wizard can enter the gdt without having
Xto recompile the source.  Finally, a man page was generated, based
Xon the dungeon.doc file.
X
XVI. f77 to C (11-mar-91)
X
XIan Lance Taylor (ian@airs.com or uunet!airs!ian) used the f2c
Xtranslator to generate C source code.  The resulting code was modified
Xto remove the FORTRAN I/O library, to add simple more processing, and
Xto change the format of the database file.  Andre Srinivasan
X(andre@cs.pitt.edu) help test it.  Jonathan Mark
X(uunet!microsoft!jonm) made it work under MS-DOS and Microsoft C.
END_OF_FILE
if test 4816 -ne `wc -c <'History'`; then
    echo shar: \"'History'\" unpacked with wrong size!
fi
# end of 'History'
fi
if test -f 'actors.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'actors.c'\"
else
echo shar: Extracting \"'actors.c'\" \(9721 characters\)
sed "s/^X//" >'actors.c' <<'END_OF_FILE'
X/* AAPPLI- APPLICABLES FOR ADVENTURERS */
X
X/*COPYRIGHT 1980, INFOCOM COMPUTERS AND COMMUNICATIONS, CAMBRIDGE MA. 02142*/
X/* ALL RIGHTS RESERVED, COMMERCIAL USAGE STRICTLY PROHIBITED */
X/* WRITTEN BY R. M. SUPNIK */
X
X#include "funcs.h"
X#include "vars.h"
X
Xlogical aappli_(ri)
Xinteger ri;
X{
X    /* System generated locals */
X    logical ret_val;
X
X    /* Local variables */
X    logical f;
X    integer i;
X
X    if (ri == 0) {
X	goto L10;
X    }
X/* 						!IF ZERO, NO APP. */
X    ret_val = TRUE_;
X/* 						!ASSUME WINS. */
X    switch (ri) {
X	case 1:  goto L1000;
X	case 2:  goto L2000;
X    }
X/* 						!BRANCH ON ADV. */
X    bug_(11, ri);
X
X/* COMMON FALSE RETURN. */
X
XL10:
X    ret_val = FALSE_;
X    return ret_val;
X
X/* A1--	ROBOT.  PROCESS MOST COMMANDS GIVEN TO ROBOT. */
X
XL1000:
X    if (prsvec_1.prsa != vindex_1.raisew || prsvec_1.prso != oindex_1.rcage) {
X
X	goto L1200;
X    }
X    cevent_1.cflag[cindex_1.cevsph - 1] = FALSE_;
X/* 						!ROBOT RAISED CAGE. */
X    play_1.winner = aindex_1.player;
X/* 						!RESET FOR PLAYER. */
X    f = moveto_(rindex_1.cager, play_1.winner);
X/* 						!MOVE TO NEW ROOM. */
X    newsta_(oindex_1.cage, 567, rindex_1.cager, 0, 0);
X/* 						!INSTALL CAGE IN ROOM. */
X    newsta_(oindex_1.robot, 0, rindex_1.cager, 0, 0);
X/* 						!INSTALL ROBOT IN ROOM. */
X    advs_1.aroom[aindex_1.arobot - 1] = rindex_1.cager;
X/* 						!ALSO MOVE ROBOT/ADV. */
X    findex_1.cagesf = TRUE_;
X/* 						!CAGE SOLVED. */
X    objcts_1.oflag1[oindex_1.robot - 1] &= ~ NDSCBT;
X    objcts_1.oflag1[oindex_1.spher - 1] |= TAKEBT;
X    return ret_val;
X
XL1200:
X    if (prsvec_1.prsa != vindex_1.drinkw && prsvec_1.prsa != vindex_1.eatw) {
X	goto L1300;
X    }
X    rspeak_(568);
X/* 						!EAT OR DRINK, JOKE. */
X    return ret_val;
X
XL1300:
X    if (prsvec_1.prsa != vindex_1.readw) {
X	goto L1400;
X    }
X/* 						!READ, */
X    rspeak_(569);
X/* 						!JOKE. */
X    return ret_val;
X
XL1400:
X    if (prsvec_1.prsa == vindex_1.walkw || prsvec_1.prsa == vindex_1.takew || 
X	    prsvec_1.prsa == vindex_1.dropw || prsvec_1.prsa == vindex_1.putw 
X	    || prsvec_1.prsa == vindex_1.pushw || prsvec_1.prsa == 
X	    vindex_1.throww || prsvec_1.prsa == vindex_1.turnw || 
X	    prsvec_1.prsa == vindex_1.leapw) {
X	goto L10;
X    }
X    rspeak_(570);
X/* 						!JOKE. */
X    return ret_val;
X/* AAPPLI, PAGE 3 */
X
X/* A2--	MASTER.  PROCESS MOST COMMANDS GIVEN TO MASTER. */
X
XL2000:
X    if ((objcts_1.oflag2[oindex_1.qdoor - 1] & OPENBT) != 0) {
X	goto L2100;
X    }
X    rspeak_(783);
X/* 						!NO MASTER YET. */
X    return ret_val;
X
XL2100:
X    if (prsvec_1.prsa != vindex_1.walkw) {
X	goto L2200;
X    }
X/* 						!WALK? */
X    i = 784;
X/* 						!ASSUME WONT. */
X    if (play_1.here == rindex_1.scorr && (prsvec_1.prso == xsrch_1.xnorth || 
X	    prsvec_1.prso == xsrch_1.xenter) || play_1.here == rindex_1.ncorr 
X	    && (prsvec_1.prso == xsrch_1.xsouth || prsvec_1.prso == 
X	    xsrch_1.xenter)) {
X	i = 785;
X    }
X    rspeak_(i);
X    return ret_val;
X
XL2200:
X    if (prsvec_1.prsa == vindex_1.takew || prsvec_1.prsa == vindex_1.dropw || 
X	    prsvec_1.prsa == vindex_1.putw || prsvec_1.prsa == 
X	    vindex_1.throww || prsvec_1.prsa == vindex_1.pushw || 
X	    prsvec_1.prsa == vindex_1.turnw || prsvec_1.prsa == 
X	    vindex_1.spinw || prsvec_1.prsa == vindex_1.trntow || 
X	    prsvec_1.prsa == vindex_1.follow || prsvec_1.prsa == 
X	    vindex_1.stayw || prsvec_1.prsa == vindex_1.openw || 
X	    prsvec_1.prsa == vindex_1.closew || prsvec_1.prsa == 
X	    vindex_1.killw) {
X	goto L10;
X    }
X    rspeak_(786);
X/* 						!MASTER CANT DO IT. */
X    return ret_val;
X
X} /* aappli_ */
X
X/* THIEFD-	INTERMOVE THIEF DEMON */
X
X/* DECLARATIONS */
X
Xvoid thiefd_()
X{
X    /* System generated locals */
X    integer i__1, i__2;
X
X    /* Local variables */
X    integer i, j, nr;
X    logical once;
X    integer rhere;
X
X/* 						!SET UP DETAIL FLAG. */
X    once = FALSE_;
X/* 						!INIT FLAG. */
XL1025:
X    rhere = objcts_1.oroom[oindex_1.thief - 1];
X/* 						!VISIBLE POS. */
X    if (rhere != 0) {
X	hack_1.thfpos = rhere;
X    }
X
X    if (hack_1.thfpos == play_1.here) {
X	goto L1100;
X    }
X/* 						!THIEF IN WIN RM? */
X    if (hack_1.thfpos != rindex_1.treas) {
X	goto L1400;
X    }
X/* 						!THIEF NOT IN TREAS? */
X
X/* THIEF IS IN TREASURE ROOM, AND WINNER IS NOT. */
X
X    if (rhere == 0) {
X	goto L1050;
X    }
X/* 						!VISIBLE? */
X    newsta_(oindex_1.thief, 0, 0, 0, 0);
X/* 						!YES, VANISH. */
X    rhere = 0;
X    if (qhere_(oindex_1.still, rindex_1.treas) || objcts_1.oadv[
X	    oindex_1.still - 1] == -oindex_1.thief) {
X	newsta_(oindex_1.still, 0, 0, oindex_1.thief, 0);
X    }
XL1050:
X    i__1 = -oindex_1.thief;
X    i = robadv_(i__1, hack_1.thfpos, 0, 0);
X/* 						!DROP VALUABLES. */
X    if (qhere_(oindex_1.egg, hack_1.thfpos)) {
X	objcts_1.oflag2[oindex_1.egg - 1] |= OPENBT;
X    }
X    goto L1700;
X
X/* THIEF AND WINNER IN SAME ROOM. */
X
XL1100:
X    if (hack_1.thfpos == rindex_1.treas) {
X	goto L1700;
X    }
X/* 						!IF TREAS ROOM, NOTHING. */
X    if ((rooms_1.rflag[hack_1.thfpos - 1] & RLIGHT) != 0) {
X	goto L1400;
X    }
X    if (hack_1.thfflg) {
X	goto L1300;
X    }
X/* 						!THIEF ANNOUNCED? */
X    if (rhere != 0 || prob_(70, 70)) {
X	goto L1150;
X    }
X/* 						!IF INVIS AND 30%. */
X    if (objcts_1.ocan[oindex_1.still - 1] != oindex_1.thief) {
X	goto L1700;
X    }
X/* 						!ABORT IF NO STILLETTO. */
X    newsta_(oindex_1.thief, 583, hack_1.thfpos, 0, 0);
X/* 						!INSERT THIEF INTO ROOM. */
X    hack_1.thfflg = TRUE_;
X/* 						!THIEF IS ANNOUNCED. */
X    return;
X
XL1150:
X    if (rhere == 0 || (objcts_1.oflag2[oindex_1.thief - 1] & FITEBT) 
X	    == 0) {
X	goto L1200;
X    }
X    if (winnin_(oindex_1.thief, play_1.winner)) {
X	goto L1175;
X    }
X/* 						!WINNING? */
X    newsta_(oindex_1.thief, 584, 0, 0, 0);
X/* 						!NO, VANISH THIEF. */
X    objcts_1.oflag2[oindex_1.thief - 1] &= ~ FITEBT;
X    if (qhere_(oindex_1.still, hack_1.thfpos) || objcts_1.oadv[
X	    oindex_1.still - 1] == -oindex_1.thief) {
X	newsta_(oindex_1.still, 0, 0, oindex_1.thief, 0);
X    }
X    return;
X
XL1175:
X    if (prob_(90, 90)) {
X	goto L1700;
X    }
X/* 						!90% CHANCE TO STAY. */
X
XL1200:
X    if (rhere == 0 || prob_(70, 70)) {
X	goto L1250;
X    }
X/* 						!IF VISIBLE AND 30% */
X    newsta_(oindex_1.thief, 585, 0, 0, 0);
X/* 						!VANISH THIEF. */
X    if (qhere_(oindex_1.still, hack_1.thfpos) || objcts_1.oadv[
X	    oindex_1.still - 1] == -oindex_1.thief) {
X	newsta_(oindex_1.still, 0, 0, oindex_1.thief, 0);
X    }
X    return;
X
XL1300:
X    if (rhere == 0) {
X	goto L1700;
X    }
X/* 						!ANNOUNCED.  VISIBLE? */
XL1250:
X    if (prob_(70, 70)) {
X	return;
X    }
X/* 						!70% CHANCE TO DO NOTHING. */
X    hack_1.thfflg = TRUE_;
X    i__1 = -oindex_1.thief;
X    i__2 = -oindex_1.thief;
X    nr = robrm_(hack_1.thfpos, 100, 0, 0, i__1) + robadv_(
X	    play_1.winner, 0, 0, i__2);
X    i = 586;
X/* 						!ROBBED EM. */
X    if (rhere != 0) {
X	i = 588;
X    }
X/* 						!WAS HE VISIBLE? */
X    if (nr != 0) {
X	++i;
X    }
X/* 						!DID HE GET ANYTHING? */
X    newsta_(oindex_1.thief, i, 0, 0, 0);
X/* 						!VANISH THIEF. */
X    if (qhere_(oindex_1.still, hack_1.thfpos) || objcts_1.oadv[
X	    oindex_1.still - 1] == -oindex_1.thief) {
X	newsta_(oindex_1.still, 0, 0, oindex_1.thief, 0);
X    }
X    if (nr != 0 && ! lit_(hack_1.thfpos)) {
X	rspeak_(406);
X    }
X    rhere = 0;
X    goto L1700;
X/* 						!ONWARD. */
X
X/* NOT IN ADVENTURERS ROOM. */
X
XL1400:
X    newsta_(oindex_1.thief, 0, 0, 0, 0);
X/* 						!VANISH. */
X    rhere = 0;
X    if (qhere_(oindex_1.still, hack_1.thfpos) || objcts_1.oadv[
X	    oindex_1.still - 1] == -oindex_1.thief) {
X	newsta_(oindex_1.still, 0, 0, oindex_1.thief, 0);
X    }
X    if ((rooms_1.rflag[hack_1.thfpos - 1] & RSEEN) == 0) {
X	goto L1700;
X    }
X    i__1 = -oindex_1.thief;
X    i = robrm_(hack_1.thfpos, 75, 0, 0, i__1);
X/* 						!ROB ROOM 75%. */
X    if (hack_1.thfpos < rindex_1.maze1 || hack_1.thfpos > rindex_1.maz15 || 
X	    play_1.here < rindex_1.maze1 || play_1.here > rindex_1.maz15) {
X	goto L1500;
X    }
X    i__1 = objcts_1.olnt;
X    for (i = 1; i <= i__1; ++i) {
X/* 						!BOTH IN MAZE. */
X	if (! qhere_(i, hack_1.thfpos) || prob_(60, 60) || (
X		objcts_1.oflag1[i - 1] & VISIBT + TAKEBT) !=
X		 VISIBT + TAKEBT) {
X	    goto L1450;
X	}
X	rspsub_(590, objcts_1.odesc2[i - 1]);
X/* 						!TAKE OBJECT. */
X	if (prob_(40, 20)) {
X	    goto L1700;
X	}
X	i__2 = -oindex_1.thief;
X	newsta_(i, 0, 0, 0, i__2);
X/* 						!MOST OF THE TIME. */
X	objcts_1.oflag2[i - 1] |= TCHBT;
X	goto L1700;
XL1450:
X	;
X    }
X    goto L1700;
X
XL1500:
X    i__1 = objcts_1.olnt;
X    for (i = 1; i <= i__1; ++i) {
X/* 						!NOT IN MAZE. */
X	if (! qhere_(i, hack_1.thfpos) || objcts_1.otval[i - 1] != 0 || 
X		prob_(80, 60) || (objcts_1.oflag1[i - 1] & 
X		VISIBT + TAKEBT) != VISIBT + 
X		TAKEBT) {
X	    goto L1550;
X	}
X	i__2 = -oindex_1.thief;
X	newsta_(i, 0, 0, 0, i__2);
X	objcts_1.oflag2[i - 1] |= TCHBT;
X	goto L1700;
XL1550:
X	;
X    }
X
X/* NOW MOVE TO NEW ROOM. */
X
XL1700:
X    if (objcts_1.oadv[oindex_1.rope - 1] == -oindex_1.thief) {
X	findex_1.domef = FALSE_;
X    }
X    if (once) {
X	goto L1800;
X    }
X    once = ! once;
XL1750:
X    --hack_1.thfpos;
X/* 						!NEXT ROOM. */
X    if (hack_1.thfpos <= 0) {
X	hack_1.thfpos = rooms_1.rlnt;
X    }
X    if ((rooms_1.rflag[hack_1.thfpos - 1] & RLAND + RSACRD + 
X	    REND) != RLAND) {
X	goto L1750;
X    }
X    hack_1.thfflg = FALSE_;
X/* 						!NOT ANNOUNCED. */
X    goto L1025;
X/* 						!ONCE MORE. */
X
X/* ALL DONE. */
X
XL1800:
X    if (hack_1.thfpos == rindex_1.treas) {
X	return;
X    }
X/* 						!IN TREASURE ROOM? */
X    j = 591;
X/* 						!NO, DROP STUFF. */
X    if (hack_1.thfpos != play_1.here) {
X	j = 0;
X    }
X    i__1 = objcts_1.olnt;
X    for (i = 1; i <= i__1; ++i) {
X	if (objcts_1.oadv[i - 1] != -oindex_1.thief || prob_(70, 70) 
X		|| objcts_1.otval[i - 1] > 0) {
X	    goto L1850;
X	}
X	newsta_(i, j, hack_1.thfpos, 0, 0);
X	j = 0;
XL1850:
X	;
X    }
X    return;
X
X} /* thiefd_ */
END_OF_FILE
if test 9721 -ne `wc -c <'actors.c'`; then
    echo shar: \"'actors.c'\" unpacked with wrong size!
fi
# end of 'actors.c'
fi
if test -f 'dgame.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'dgame.c'\"
else
echo shar: Extracting \"'dgame.c'\" \(5290 characters\)
sed "s/^X//" >'dgame.c' <<'END_OF_FILE'
X/* GAME- MAIN COMMAND LOOP FOR DUNGEON */
X
X/*COPYRIGHT 1980, INFOCOM COMPUTERS AND COMMUNICATIONS, CAMBRIDGE MA. 02142*/
X/* ALL RIGHTS RESERVED, COMMERCIAL USAGE STRICTLY PROHIBITED */
X/* WRITTEN BY R. M. SUPNIK */
X
X#include <stdio.h>
X#include "funcs.h"
X#include "vars.h"
X
X/* Do all systems have <string.h>?  Don't use it, just in case */
X
Xextern int strcmp P((const char *, const char *));
X
Xstatic logical xvehic_ P((integer));
Xstatic void xendmv_ P((logical));
X
Xvoid game_()
X{
X    /* Local variables */
X    logical f;
X    integer i;
X
X/* START UP, DESCRIBE CURRENT LOCATION. */
X
X    rspeak_(1);
X/* 						!WELCOME ABOARD. */
X    f = rmdesc_(3);
X/* 						!START GAME. */
X
X/* NOW LOOP, READING AND EXECUTING COMMANDS. */
X
XL100:
X    play_1.winner = aindex_1.player;
X/* 						!PLAYER MOVING. */
X    play_1.telflg = FALSE_;
X/* 						!ASSUME NOTHING TOLD. */
X    if (prsvec_1.prscon <= 1) {
X	rdline_(input_1.inbuf, 1);
X    }
X
X#ifdef ALLOW_GDT
X
X    if (strcmp(input_1.inbuf + prsvec_1.prscon - 1, "GDT") == 0) {
X/* 						!CALL ON GDT? */
X	gdt_();
X/* 						!YES, INVOKE. */
X	goto L100;
X/* 						!ONWARD. */
X    }
X
X#endif /* ALLOW_GDT */
X
X    ++state_1.moves;
X    prsvec_1.prswon = parse_(input_1.inbuf, 1);
X    if (! prsvec_1.prswon) {
X	goto L400;
X    }
X/* 						!PARSE LOSES? */
X    if (xvehic_(1)) {
X	goto L400;
X    }
X/* 						!VEHICLE HANDLE? */
X
X    if (prsvec_1.prsa == vindex_1.tellw) {
X	goto L2000;
X    }
X/* 						!TELL? */
XL300:
X    if (prsvec_1.prso == oindex_1.valua || prsvec_1.prso == oindex_1.every) {
X	goto L900;
X    }
X    if (! vappli_(prsvec_1.prsa)) {
X	goto L400;
X    }
X/* 						!VERB OK? */
XL350:
X    if (! findex_1.echof && play_1.here == rindex_1.echor) {
X	goto L1000;
X    }
X    f = rappli_(rooms_1.ractio[play_1.here - 1]);
X
XL400:
X    xendmv_(play_1.telflg);
X/* 						!DO END OF MOVE. */
X    if (! lit_(play_1.here)) {
X	prsvec_1.prscon = 1;
X    }
X    goto L100;
X
XL900:
X    valuac_(oindex_1.valua);
X    goto L350;
X/* GAME, PAGE 3 */
X
X/* SPECIAL CASE-- ECHO ROOM. */
X/* IF INPUT IS NOT 'ECHO' OR A DIRECTION, JUST ECHO. */
X
XL1000:
X    rdline_(input_1.inbuf, 0);
X    ++state_1.moves;
X/* 						!CHARGE FOR MOVES. */
X    if (strcmp(input_1.inbuf, "ECHO") != 0)
X	goto L1300;
X
X    rspeak_(571);
X/* 						!KILL THE ECHO. */
X    findex_1.echof = TRUE_;
X    objcts_1.oflag2[oindex_1.bar - 1] &= ~ SCRDBT;
X    prsvec_1.prswon = TRUE_;
X/* 						!FAKE OUT PARSER. */
X    prsvec_1.prscon = 1;
X/* 						!FORCE NEW INPUT. */
X    goto L400;
X
XL1300:
X    prsvec_1.prswon = parse_(input_1.inbuf, 0);
X    if (! prsvec_1.prswon || prsvec_1.prsa != vindex_1.walkw) {
X	goto L1400;
X    }
X    if (findxt_(prsvec_1.prso, play_1.here)) {
X	goto L300;
X    }
X/* 						!VALID EXIT? */
X
XL1400:
X    more_output(input_1.inbuf);
X    play_1.telflg = TRUE_;
X/* 						!INDICATE OUTPUT. */
X    goto L1000;
X/* 						!MORE ECHO ROOM. */
X/* GAME, PAGE 4 */
X
X/* SPECIAL CASE-- TELL <ACTOR>, NEW COMMAND */
X/* NOTE THAT WE CANNOT BE IN THE ECHO ROOM. */
X
XL2000:
X    if ((objcts_1.oflag2[prsvec_1.prso - 1] & ACTRBT) != 0) {
X	goto L2100;
X    }
X    rspeak_(602);
X/* 						!CANT DO IT. */
X    goto L350;
X/* 						!VAPPLI SUCCEEDS. */
X
XL2100:
X    play_1.winner = oactor_(prsvec_1.prso);
X/* 						!NEW PLAYER. */
X    play_1.here = advs_1.aroom[play_1.winner - 1];
X/* 						!NEW LOCATION. */
X    if (prsvec_1.prscon <= 1) {
X	goto L2700;
X    }
X/* 						!ANY INPUT? */
X    if (parse_(input_1.inbuf, 1)) {
X	goto L2150;
X    }
XL2700:
X    i = 341;
X/* 						!FAILS. */
X    if (play_1.telflg) {
X	i = 604;
X    }
X/* 						!GIVE RESPONSE. */
X    rspeak_(i);
XL2600:
X    play_1.winner = aindex_1.player;
X/* 						!RESTORE STATE. */
X    play_1.here = advs_1.aroom[play_1.winner - 1];
X    goto L350;
X
XL2150:
X    if (aappli_(advs_1.aactio[play_1.winner - 1])) {
X	goto L2400;
X    }
X/* 						!ACTOR HANDLE? */
X    if (xvehic_(1)) {
X	goto L2400;
X    }
X/* 						!VEHICLE HANDLE? */
X    if (prsvec_1.prso == oindex_1.valua || prsvec_1.prso == oindex_1.every) {
X	goto L2900;
X    }
X    if (! vappli_(prsvec_1.prsa)) {
X	goto L2400;
X    }
X/* 						!VERB HANDLE? */
X/* L2350: */
X    f = rappli_(rooms_1.ractio[play_1.here - 1]);
X
XL2400:
X    xendmv_(play_1.telflg);
X/* 						!DO END OF MOVE. */
X    goto L2600;
X/* 						!DONE. */
X
XL2900:
X    valuac_(oindex_1.valua);
X/* 						!ALL OR VALUABLES. */
X    goto L350;
X
X} /* game_ */
X
X/* XENDMV-	EXECUTE END OF MOVE FUNCTIONS. */
X
X/* DECLARATIONS */
X
Xstatic void xendmv_(flag)
Xlogical flag;
X{
X    /* Local variables */
X    logical f;
X
X    if (! (flag)) {
X	rspeak_(341);
X    }
X/* 						!DEFAULT REMARK. */
X    if (hack_1.thfact) {
X	thiefd_();
X    }
X/* 						!THIEF DEMON. */
X    if (prsvec_1.prswon) {
X	fightd_();
X    }
X/* 						!FIGHT DEMON. */
X    if (hack_1.swdact) {
X	swordd_();
X    }
X/* 						!SWORD DEMON. */
X    if (prsvec_1.prswon) {
X	f = clockd_();
X    }
X/* 						!CLOCK DEMON. */
X    if (prsvec_1.prswon) {
X	f = xvehic_(2);
X    }
X/* 						!VEHICLE READOUT. */
X} /* xendmv_ */
X
X/* XVEHIC- EXECUTE VEHICLE FUNCTION */
X
X/* DECLARATIONS */
X
Xstatic logical xvehic_(n)
Xinteger n;
X{
X    /* System generated locals */
X    logical ret_val;
X
X    /* Local variables */
X    integer av;
X
X    ret_val = FALSE_;
X/* 						!ASSUME LOSES. */
X    av = advs_1.avehic[play_1.winner - 1];
X/* 						!GET VEHICLE. */
X    if (av != 0) {
X	ret_val = oappli_(objcts_1.oactio[av - 1], n);
X    }
X    return ret_val;
X} /* xvehic_ */
END_OF_FILE
if test 5290 -ne `wc -c <'dgame.c'`; then
    echo shar: \"'dgame.c'\" unpacked with wrong size!
fi
# end of 'dgame.c'
fi
if test -f 'dso3.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'dso3.c'\"
else
echo shar: Extracting \"'dso3.c'\" \(4032 characters\)
sed "s/^X//" >'dso3.c' <<'END_OF_FILE'
X/* FINDXT- FIND EXIT FROM ROOM */
X
X/*COPYRIGHT 1980, INFOCOM COMPUTERS AND COMMUNICATIONS, CAMBRIDGE MA. 02142*/
X/* ALL RIGHTS RESERVED, COMMERCIAL USAGE STRICTLY PROHIBITED */
X/* WRITTEN BY R. M. SUPNIK */
X
X#include <stdio.h>
X#include "funcs.h"
X#include "vars.h"
X
Xlogical findxt_(dir, rm)
Xinteger dir;
Xinteger rm;
X{
X    /* System generated locals */
X    logical ret_val;
X
X    /* Local variables */
X    integer i, xi;
X    integer xxxflg;
X
X    ret_val = TRUE_;
X/* 						!ASSUME WINS. */
X    xi = rooms_1.rexit[rm - 1];
X/* 						!FIND FIRST ENTRY. */
X    if (xi == 0) {
X	goto L1000;
X    }
X/* 						!NO EXITS? */
X
XL100:
X    i = exits_1.travel[xi - 1];
X/* 						!GET ENTRY. */
X    curxt_1.xroom1 = i & xpars_1.xrmask;
X/* mask to 16-bits to get rid of sign extension problems with 32-bit ints 
X*/
X    xxxflg = ~ xpars_1.xlflag & 65535;
X    curxt_1.xtype = ((i & xxxflg) / xpars_1.xfshft & xpars_1.xfmask) + 1;
X    switch (curxt_1.xtype) {
X	case 1:  goto L110;
X	case 2:  goto L120;
X	case 3:  goto L130;
X	case 4:  goto L130;
X    }
X/* 						!BRANCH ON ENTRY. */
X    bug_(10, curxt_1.xtype);
X
XL130:
X    curxt_1.xobj = exits_1.travel[xi + 1] & xpars_1.xrmask;
X    curxt_1.xactio = exits_1.travel[xi + 1] / xpars_1.xashft;
XL120:
X    curxt_1.xstrng = exits_1.travel[xi];
X/* 						!DOOR/CEXIT/NEXIT - STRING. */
XL110:
X    xi += xpars_1.xelnt[curxt_1.xtype - 1];
X/* 						!ADVANCE TO NEXT ENTRY. */
X    if ((i & xpars_1.xdmask) == dir) {
X	return ret_val;
X    }
X    if ((i & xpars_1.xlflag) == 0) {
X	goto L100;
X    }
XL1000:
X    ret_val = FALSE_;
X/* 						!YES, LOSE. */
X    return ret_val;
X} /* findxt_ */
X
X/* FWIM- FIND WHAT I MEAN */
X
X/* DECLARATIONS */
X
Xinteger fwim_(f1, f2, rm, con, adv, nocare)
Xinteger f1;
Xinteger f2;
Xinteger rm;
Xinteger con;
Xinteger adv;
Xlogical nocare;
X{
X    /* System generated locals */
X    integer ret_val, i__1, i__2;
X
X    /* Local variables */
X    integer i, j;
X
X
X/* OBJECTS */
X
X
X
X
X    ret_val = 0;
X/* 						!ASSUME NOTHING. */
X    i__1 = objcts_1.olnt;
X    for (i = 1; i <= i__1; ++i) {
X/* 						!LOOP */
X	if ((rm == 0 || objcts_1.oroom[i - 1] != rm) && (adv == 0 || 
X		objcts_1.oadv[i - 1] != adv) && (con == 0 || objcts_1.ocan[
X		i - 1] != con)) {
X	    goto L1000;
X	}
X
X/* OBJECT IS ON LIST... IS IT A MATCH? */
X
X	if ((objcts_1.oflag1[i - 1] & VISIBT) == 0) {
X	    goto L1000;
X	}
X	if (~ (nocare) & (objcts_1.oflag1[i - 1] & TAKEBT) == 0 || (
X		objcts_1.oflag1[i - 1] & f1) == 0 && (objcts_1.oflag2[i - 1] 
X		& f2) == 0) {
X	    goto L500;
X	}
X	if (ret_val == 0) {
X	    goto L400;
X	}
X/* 						!ALREADY GOT SOMETHING? */
X	ret_val = -ret_val;
X/* 						!YES, AMBIGUOUS. */
X	return ret_val;
X
XL400:
X	ret_val = i;
X/* 						!NOTE MATCH. */
X
X/* DOES OBJECT CONTAIN A MATCH? */
X
XL500:
X	if ((objcts_1.oflag2[i - 1] & OPENBT) == 0) {
X	    goto L1000;
X	}
X	i__2 = objcts_1.olnt;
X	for (j = 1; j <= i__2; ++j) {
X/* 						!NO, SEARCH CONTENTS. */
X	    if (objcts_1.ocan[j - 1] != i || (objcts_1.oflag1[j - 1] & 
X		    VISIBT) == 0 || (objcts_1.oflag1[j - 1] & f1) ==
X		     0 && (objcts_1.oflag2[j - 1] & f2) == 0) {
X		goto L700;
X	    }
X	    if (ret_val == 0) {
X		goto L600;
X	    }
X	    ret_val = -ret_val;
X	    return ret_val;
X
XL600:
X	    ret_val = j;
XL700:
X	    ;
X	}
XL1000:
X	;
X    }
X    return ret_val;
X} /* fwim_ */
X
X/* YESNO- OBTAIN YES/NO ANSWER */
X
X/* CALLED BY- */
X
X/* 	YES-IS-TRUE=YESNO(QUESTION,YES-STRING,NO-STRING) */
X
Xlogical yesno_(q, y, n)
Xinteger q;
Xinteger y;
Xinteger n;
X{
X    /* System generated locals */
X    logical ret_val;
X
X    /* Local variables */
X    char ans[100];
X
XL100:
X    rspeak_(q);
X/* 						!ASK */
X    (void) fflush(stdout);
X    (void) fgets(ans, sizeof ans, stdin);
X    more_input();
X/* 						!GET ANSWER */
X    if (*ans == 'Y' || *ans == 'y') {
X	goto L200;
X    }
X    if (*ans == 'N' || *ans == 'n') {
X	goto L300;
X    }
X    rspeak_(6);
X/* 						!SCOLD. */
X    goto L100;
X
XL200:
X    ret_val = TRUE_;
X/* 						!YES, */
X    rspeak_(y);
X/* 						!OUT WITH IT. */
X    return ret_val;
X
XL300:
X    ret_val = FALSE_;
X/* 						!NO, */
X    rspeak_(n);
X/* 						!LIKEWISE. */
X    return ret_val;
X
X} /* yesno_ */
END_OF_FILE
if test 4032 -ne `wc -c <'dso3.c'`; then
    echo shar: \"'dso3.c'\" unpacked with wrong size!
fi
# end of 'dso3.c'
fi
if test -f 'dungeon.6' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'dungeon.6'\"
else
echo shar: Extracting \"'dungeon.6'\" \(8222 characters\)
sed "s/^X//" >'dungeon.6' <<'END_OF_FILE'
X.TH DUNGEON 6 "March 11, 1991"
X.SH NAME
Xdungeon\ -\ Adventures in the Dungeons of Doom
X.SH SYNOPSIS
X.B dungeon
X.SH DESCRIPTION
XDungeon is a game of adventure, danger, and low cunning.  In it
Xyou will explore some of the most amazing territory ever seen by mortal
Xman.  Hardened adventurers have run screaming from the terrors contained
Xwithin.
X.LP
XIn Dungeon, the intrepid explorer delves into the forgotten secrets
Xof a lost labyrinth deep in the bowels of the earth, searching for
Xvast treasures long hidden from prying eyes, treasures guarded by
Xfearsome monsters and diabolical traps!
X.LP
XDungeon was created at the Programming Technology Division of the MIT
XLaboratory for Computer Science by Tim Anderson, Marc Blank, Bruce
XDaniels, and Dave Lebling.  It was inspired by the Adventure game of
XCrowther and Woods, and the Dungeons and Dragons game of Gygax
Xand Arneson.  The original version was written in MDL (alias MUDDLE).
XThe current version was translated from MDL into FORTRAN IV by
Xa somewhat paranoid DEC engineer who prefers to remain anonymous.
X.LP
XOn-line information may be obtained with the commands HELP and INFO.
X.SH DETAILS
XFollowing is the summary produced by the
X.B info
Xcommand:
X.RS
X.LP
XWelcome to Dungeon!
X.PP
XYou are near a large dungeon, which is reputed to contain vast
Xquantities of treasure.   Naturally, you wish to acquire some of it.
XIn order to do so, you must of course remove it from the dungeon.  To
Xreceive full credit for it, you must deposit it safely in the trophy
Xcase in the living room of the house.
X.PP
XIn addition to valuables, the dungeon contains various objects
Xwhich may or may not be useful in your attempt to get rich.  You may
Xneed sources of light, since dungeons are often dark, and weapons,
Xsince dungeons often have unfriendly things wandering about.  Reading
Xmaterial is scattered around the dungeon as well;  some of it
Xis rumored to be useful.
X.PP
XTo determine how successful you have been, a score is kept.
XWhen you find a valuable object and pick it up, you receive a
Xcertain number of points, which depends on the difficulty of finding
Xthe object.  You receive extra points for transporting the treasure
Xsafely to the living room and placing it in the trophy case.  In
Xaddition, some particularly interesting rooms have a value associated
Xwith visiting them.  The only penalty is for getting yourself killed,
Xwhich you may do only twice.
X.PP
XOf special note is a thief (always carrying a large bag) who
Xlikes to wander around in the dungeon (he has never been seen by the
Xlight of day).  He likes to take things.  Since he steals for pleasure
Xrather than profit and is somewhat sadistic, he only takes things which
Xyou have seen.  Although he prefers valuables, sometimes in his haste
Xhe may take something which is worthless.  From time to time, he examines
Xhis take and discards objects which he doesn't like.  He may occasionally 
Xstop in a room you are visiting, but more often he just wanders
Xthrough and rips you off (he is a skilled pickpocket).
X.RE
X.SH COMMANDS
X.LP
X.TP 15
X.B brief
Xsuppresses printing of long room descriptions
Xfor rooms which have been visited.
X.TP
X.B superbrief
Xsuppresses
Xprinting of long room descriptions for all rooms.
X.TP
X.B verbose
Xrestores long descriptions.
X.TP
X.B info
Xprints information which might give some idea
Xof what the game is about.
X.TP
X.B quit
Xprints your score and asks whether you wish
Xto continue playing.
X.TP
X.B save
Xsaves the state of the game for later continuation.
X.TP
X.B restore
Xrestores a saved game.
X.TP
X.B inventory
Xlists the objects in your possession.
X.TP
X.B look
Xprints a description of your surroundings.
X.TP
X.B score
Xprints your current score and ranking.
X.TP
X.B time
Xtells you how long you have been playing.
X.TP
X.B diagnose
Xreports on your injuries, if any.
X.LP
XThe
X.B inventory
Xcommand may be abbreviated
X.BR i ;
Xthe
X.B look
Xcommand may be abbreviated
X.BR l ;
Xthe
X.B quit
Xcommand may be abbreviated
X.BR q .
X.LP
XA command that begins with '!' as the first character is taken to
Xbe a shell command and is passed unchanged to the shell via
X.I system(3).
X.SH CONTAINMENT
X.LP
XSome objects can contain other objects.  Many such containers can
Xbe opened and closed.  The rest are always open.   They may or may
Xnot be transparent.  For you to access (e.g., take) an object
Xwhich is in a container, the container must be open.  For you
Xto see such an object, the container must be either open or
Xtransparent.  Containers have a capacity, and objects have sizes;
Xthe number of objects which will fit therefore depends on their
Xsizes.  You may put any object you have access to (it need not be
Xin your hands) into any other object.  At some point, the program
Xwill attempt to pick it up if you don't already have it, which
Xprocess may fail if you're carrying too much.  Although containers
Xcan contain other containers, the program doesn't access more than
Xone level down.
X.SH FIGHTING
X.LP
XOccupants of the dungeon will, as a rule, fight back when
Xattacked.  In some cases, they may attack even if unprovoked.
XUseful verbs here are 
X.I attack
X<villain>
X.I with
X<weapon>,
X.IR kill ,
Xetc.  Knife-throwing may or may not be useful.  You have a
Xfighting strength which varies with time.  Being in a fight,
Xgetting killed, and being injured all lower this strength.
XStrength is regained with time.  Thus, it is not a good idea to
Xfight someone immediately after being killed.  Other details
Xshould become apparent after a few melees or deaths.
X.SH COMMAND\ PARSER
X.LP
XA command is one line of text terminated by a carriage return.
XFor reasons of simplicity, all words are distinguished by their
Xfirst six letters.  All others are ignored.  For example, typing
X.I disassemble the encyclopedia
Xis not only meaningless, it also
Xcreates excess effort for your fingers.  Note that this truncation
Xmay produce ambiguities in the intepretation of longer words.
X[Also note that upper and lower case are equivalent.]
X.LP
XYou are dealing with a fairly stupid parser, which understands
Xthe following types of things:
X.RS
X.TP 5
X.B Actions:
XAmong the more obvious of these, such as
X.I take, put, drop,
Xetc.
XFairly general forms of these may be used, such as
X.I pick up, put down,
Xetc.
X.TP
X.B Directions:
X.I north, south, up, down,
Xetc. and their various abbreviations.
XOther more obscure directions
X.RI ( land,
X.IR cross )
Xare appropriate in only certain situations.
X.TP
X.B Objects:
XMost objects have names and can be referenced by them.
X.TP
X.B Adjectives:
XSome adjectives are understood and required when there are
Xtwo objects which can be referenced with the same 'name' (e.g.,
X.I doors,
X.IR buttons ).
X.TP
X.B Prepositions:
XIt may be necessary in some cases to include prepositions, but
Xthe parser attempts to handle cases which aren't ambiguous
Xwithout.  Thus
X.I give car to demon
Xwill work, as will
X.I give demon
X.IR car .
X.I give car demon
Xprobably won't do anything interesting.
XWhen a preposition is used, it should be appropriate;
X.I give car with demon
Xwon't parse.
X.TP
X.B Sentences:
XThe parser understands a reasonable number of syntactic construc-
Xtions.  In particular, multiple commands (separated by commas)
Xcan be placed on the same line.
X.TP
X.B Ambiguity:
XThe parser tries to be clever about what to do in the case of
Xactions which require objects that are not explicitly specified.
XIf there is only one possible object, the parser will assume
Xthat it should be used.  Otherwise, the parser will ask.
XMost questions asked by the parser can be answered.
X.RE
X.SH FILES
Xdtextc.dat	- encoded messages and initialization information
X.br
Xdsave.dat 	- save file
X.SH BUGS
XFor those familiar with the MDL version of the game on the ARPAnet,
Xthe following is a list of the major incompatabilties:
X.RS
X-The first six letters of a word are considered
Xsignificant, instead of the first five.
X.br
X-The syntax for
X.I tell, answer,
Xand
X.I incant
Xis different.
X.br
X-Compound objects are not recognized.
X.br
X-Compound commands can be delimited with comma as well
Xas period.
X.RE
X.LP
XAlso, the palantir, brochure, and dead man problems are not
Ximplemented.
X.SH AUTHORS
X.LP
XMany people have had a hand in this version.  See the "History" and
X"README" files for credits.  Send bug reports to ian@airs.com
X(or uunet!airs!ian).
END_OF_FILE
if test 8222 -ne `wc -c <'dungeon.6'`; then
    echo shar: \"'dungeon.6'\" unpacked with wrong size!
fi
# end of 'dungeon.6'
fi
if test -f 'np1.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'np1.c'\"
else
echo shar: Extracting \"'np1.c'\" \(7379 characters\)
sed "s/^X//" >'np1.c' <<'END_OF_FILE'
X/* SPARSE-	START OF PARSE */
X
X/*COPYRIGHT 1980, INFOCOM COMPUTERS AND COMMUNICATIONS, CAMBRIDGE MA. 02142*/
X/* ALL RIGHTS RESERVED, COMMERCIAL USAGE STRICTLY PROHIBITED */
X/* WRITTEN BY R. M. SUPNIK */
X
X#include "funcs.h"
X#include "vars.h"
X
X#undef EXTERN
X#define EXTERN
X#define INIT
X
X#include "parse.h"
X
X/* THIS ROUTINE DETAILS ON BIT 2 OF PRSFLG */
X
Xinteger sparse_(lbuf, llnt, vbflag)
Xconst integer *lbuf;
Xinteger llnt;
Xlogical vbflag;
X{
X    /* Initialized data */
X
X/* 	DATA R50MIN/1RA/,R50WAL/3RWAL/ */
X    const integer r50min = 1600;
X    const integer r50wal = 36852;
X
X    /* System generated locals */
X    integer ret_val, i__1, i__2;
X
X    /* Local variables */
X    integer i, j, adj;
X    integer obj;
X    integer prep, pptr, lbuf1, lbuf2;
X    integer buzlnt, prplnt, dirlnt;
X
X    /* Parameter adjustments */
X    --lbuf;
X
X    /* Function Body */
X
X/* SET UP FOR PARSING */
X
X    ret_val = -1;
X/* 						!ASSUME PARSE FAILS. */
X    adj = 0;
X/* 						!CLEAR PARTS HOLDERS. */
X    pv_1.act = 0;
X    prep = 0;
X    pptr = 0;
X    pv_1.o1 = 0;
X    pv_1.o2 = 0;
X    pv_1.p1 = 0;
X    pv_1.p2 = 0;
X
X    buzlnt = 20;
X    prplnt = 48;
X    dirlnt = 75;
X/* SPARSE, PAGE 8 */
X
X/* NOW LOOP OVER INPUT BUFFER OF LEXICAL TOKENS. */
X
X    i__1 = llnt;
X    for (i = 1; i <= i__1; i += 2) {
X/* 						!TWO WORDS/TOKEN. */
X	lbuf1 = lbuf[i];
X/* 						!GET CURRENT TOKEN. */
X	lbuf2 = lbuf[i + 1];
X	if (lbuf1 == 0) {
X	    goto L1500;
X	}
X/* 						!END OF BUFFER? */
X
X/* CHECK FOR BUZZ WORD */
X
X	i__2 = buzlnt;
X	for (j = 1; j <= i__2; j += 2) {
X	    if (lbuf1 == buzvoc_1.bvoc[j - 1] && lbuf2 == buzvoc_1.bvoc[j]) {
X		goto L1000;
X	    }
X/* L50: */
X	}
X
X/* CHECK FOR ACTION OR DIRECTION */
X
X	if (pv_1.act != 0) {
X	    goto L75;
X	}
X/* 						!GOT ACTION ALREADY? */
X	j = 1;
X/* 						!CHECK FOR ACTION. */
XL125:
X	if (lbuf1 == vvoc[j - 1] && lbuf2 == vvoc[j]) {
X	    goto L3000;
X	}
X/* L150: */
X	j += 2;
X/* 						!ADV TO NEXT SYNONYM. */
X	if (! (vvoc[j - 1] > 0 && vvoc[j - 1] < r50min)) {
X	    goto L125;
X	}
X/* 						!ANOTHER VERB? */
X	j = j + vvoc[j - 1] + 1;
X/* 						!NO, ADVANCE OVER SYNTAX. */
X	if (vvoc[j - 1] != -1) {
X	    goto L125;
X	}
X/* 						!TABLE DONE? */
X
XL75:
X	if (pv_1.act != 0 && (vvoc[pv_1.act - 1] != r50wal || prep != 0)) {
X	    goto L200;
X	}
X	i__2 = dirlnt;
X	for (j = 1; j <= i__2; j += 3) {
X/* 						!THEN CHK FOR DIR. */
X	    if (lbuf1 == dirvoc_1.dvoc[j - 1] && lbuf2 == dirvoc_1.dvoc[j]) {
X		goto L2000;
X	    }
X/* L100: */
X	}
X
X/* NOT AN ACTION, CHECK FOR PREPOSITION, ADJECTIVE, OR OBJECT. */
X
XL200:
X	i__2 = prplnt;
X	for (j = 1; j <= i__2; j += 3) {
X/* 						!LOOK FOR PREPOSITION. */
X	    if (lbuf1 == prpvoc_1.pvoc[j - 1] && lbuf2 == prpvoc_1.pvoc[j]) {
X		goto L4000;
X	    }
X/* L250: */
X	}
X
X	j = 1;
X/* 						!LOOK FOR ADJECTIVE. */
XL300:
X	if (lbuf1 == avoc[j - 1] && lbuf2 == avoc[j]) {
X	    goto L5000;
X	}
X	++j;
XL325:
X	++j;
X/* 						!ADVANCE TO NEXT ENTRY. */
X	if (avoc[j - 1] > 0 && avoc[j - 1] < r50min) {
X	    goto L325;
X	}
X/* 						!A RADIX 50 CONSTANT? */
X	if (avoc[j - 1] != -1) {
X	    goto L300;
X	}
X/* 						!POSSIBLY, END TABLE? */
X
X	j = 1;
X/* 						!LOOK FOR OBJECT. */
XL450:
X	if (lbuf1 == ovoc[j - 1] && lbuf2 == ovoc[j]) {
X	    goto L600;
X	}
X	++j;
XL500:
X	++j;
X	if (ovoc[j - 1] > 0 && ovoc[j - 1] < r50min) {
X	    goto L500;
X	}
X	if (ovoc[j - 1] != -1) {
X	    goto L450;
X	}
X
X/* NOT RECOGNIZABLE */
X
X	if (vbflag) {
X	    rspeak_(601);
X	}
X	return ret_val;
X/* SPARSE, PAGE 9 */
X
X/* OBJECT PROCESSING (CONTINUATION OF DO LOOP ON PREV PAGE) */
X
XL600:
X	obj = getobj_(j, adj, 0);
X/* 						!IDENTIFY OBJECT. */
X	if (obj <= 0) {
X	    goto L6000;
X	}
X/* 						!IF LE, COULDNT. */
X	if (obj != oindex_1.itobj) {
X	    goto L650;
X	}
X/* 						!"IT"? */
X	obj = getobj_(0, 0, last_1.lastit);
X/* 						!FIND LAST. */
X	if (obj <= 0) {
X	    goto L6000;
X	}
X/* 						!IF LE, COULDNT. */
X
XL650:
X	if (prep == 9) {
X	    goto L8000;
X	}
X/* 						!"OF" OBJ? */
X	if (pptr == 2) {
X	    goto L7000;
X	}
X/* 						!TOO MANY OBJS? */
X	++pptr;
X	objvec[pptr - 1] = obj;
X/* 						!STUFF INTO VECTOR. */
X	prpvec[pptr - 1] = prep;
XL700:
X	prep = 0;
X	adj = 0;
X/* Go to end of do loop (moved "1000 CONTINUE" to end of module, to av
Xoid */
X/* complaints about people jumping back into the doloop.) */
X	goto L1000;
X/* SPARSE, PAGE 10 */
X
X/* SPECIAL PARSE PROCESSORS */
X
X/* 2000--	DIRECTION */
X
XL2000:
X	prsvec_1.prsa = vindex_1.walkw;
X	prsvec_1.prso = dirvoc_1.dvoc[j + 1];
X	ret_val = 1;
X	return ret_val;
X
X/* 3000--	ACTION */
X
XL3000:
X	pv_1.act = j;
X	orphs_1.oact = 0;
X	goto L1000;
X
X/* 4000--	PREPOSITION */
X
XL4000:
X	if (prep != 0) {
X	    goto L4500;
X	}
X	prep = prpvoc_1.pvoc[j + 1];
X	adj = 0;
X	goto L1000;
X
XL4500:
X	if (vbflag) {
X	    rspeak_(616);
X	}
X	return ret_val;
X
X/* 5000--	ADJECTIVE */
X
XL5000:
X	adj = j;
X	j = orphs_1.oname & orphs_1.oflag;
X	if (j != 0 && i >= llnt) {
X	    goto L600;
X	}
X	goto L1000;
X
X/* 6000--	UNIDENTIFIABLE OBJECT (INDEX INTO OVOC IS J) */
X
XL6000:
X	if (obj < 0) {
X	    goto L6100;
X	}
X	j = 579;
X	if (lit_(play_1.here)) {
X	    j = 618;
X	}
X	if (vbflag) {
X	    rspeak_(j);
X	}
X	return ret_val;
X
XL6100:
X	if (obj != -10000) {
X	    goto L6200;
X	}
X	if (vbflag) {
X	    rspsub_(620, objcts_1.odesc2[advs_1.avehic[play_1.winner - 1]
X		     - 1]);
X	}
X	return ret_val;
X
XL6200:
X	if (vbflag) {
X	    rspeak_(619);
X	}
X	if (pv_1.act == 0) {
X	    pv_1.act = orphs_1.oflag & orphs_1.oact;
X	}
X	orphan_(- 1, pv_1.act, pv_1.o1, prep, j);
X	return ret_val;
X
X/* 7000--	TOO MANY OBJECTS. */
X
XL7000:
X	if (vbflag) {
X	    rspeak_(617);
X	}
X	return ret_val;
X
X/* 8000--	RANDOMNESS FOR "OF" WORDS */
X
XL8000:
X	if (objvec[pptr - 1] == obj) {
X	    goto L700;
X	}
X	if (vbflag) {
X	    rspeak_(601);
X	}
X	return ret_val;
X
X/* End of do-loop. */
X
XL1000:
X	;
X    }
X/* 						!AT LAST. */
X
X/* NOW SOME MISC CLEANUP -- We fell out of the do-loop */
X
XL1500:
X    if (pv_1.act == 0) {
X	pv_1.act = orphs_1.oflag & orphs_1.oact;
X    }
X    if (pv_1.act == 0) {
X	goto L9000;
X    }
X/* 						!IF STILL NONE, PUNT. */
X    if (adj != 0) {
X	goto L10000;
X    }
X/* 						!IF DANGLING ADJ, PUNT. */
X
X    if (orphs_1.oflag != 0 && orphs_1.oprep != 0 && prep == 0 && pv_1.o1 != 0 
X	    && pv_1.o2 == 0 && pv_1.act == orphs_1.oact) {
X	goto L11000;
X    }
X
X    ret_val = 0;
X/* 						!PARSE SUCCEEDS. */
X    if (prep == 0) {
X	goto L1750;
X    }
X/* 						!IF DANGLING PREP, */
X    if (pptr == 0 || prpvec[pptr - 1] != 0) {
X	goto L12000;
X    }
X    prpvec[pptr - 1] = prep;
X/* 						!CVT TO 'PICK UP FROB'. */
X
X/* 1750--	RETURN A RESULT */
X
XL1750:
X/* 						!WIN. */
X    return ret_val;
X/* 						!LOSE. */
X
X/* 9000--	NO ACTION, PUNT */
X
XL9000:
X    if (pv_1.o1 == 0) {
X	goto L10000;
X    }
X/* 						!ANY DIRECT OBJECT? */
X    if (vbflag) {
X	rspsub_(621, objcts_1.odesc2[pv_1.o1 - 1]);
X    }
X/* 						!WHAT TO DO? */
X    orphan_(- 1, 0, pv_1.o1, 0, 0);
X    return ret_val;
X
X/* 10000--	TOTAL CHOMP */
X
XL10000:
X    if (vbflag) {
X	rspeak_(622);
X    }
X/* 						!HUH? */
X    return ret_val;
X
X/* 11000--	ORPHAN PREPOSITION.  CONDITIONS ARE */
X/* 		O1.NE.0, O2=0, PREP=0, ACT=OACT */
X
XL11000:
X    if (orphs_1.oslot != 0) {
X	goto L11500;
X    }
X/* 						!ORPHAN OBJECT? */
X    pv_1.p1 = orphs_1.oprep;
X/* 						!NO, JUST USE PREP. */
X    goto L1750;
X
XL11500:
X    pv_1.o2 = pv_1.o1;
X/* 						!YES, USE AS DIRECT OBJ. */
X    pv_1.p2 = orphs_1.oprep;
X    pv_1.o1 = orphs_1.oslot;
X    pv_1.p1 = 0;
X    goto L1750;
X
X/* 12000--	TRUE HANGING PREPOSITION. */
X/* 		ORPHAN FOR LATER. */
X
XL12000:
X    orphan_(- 1, pv_1.act, 0, prep, 0);
X/* 						!ORPHAN PREP. */
X    goto L1750;
X
X} /* sparse_ */
END_OF_FILE
if test 7379 -ne `wc -c <'np1.c'`; then
    echo shar: \"'np1.c'\" unpacked with wrong size!
fi
# end of 'np1.c'
fi
if test -f 'np2.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'np2.c'\"
else
echo shar: Extracting \"'np2.c'\" \(6169 characters\)
sed "s/^X//" >'np2.c' <<'END_OF_FILE'
X/* GETOBJ--	FIND OBJ DESCRIBED BY ADJ, NAME PAIR */
X
X/*COPYRIGHT 1980, INFOCOM COMPUTERS AND COMMUNICATIONS, CAMBRIDGE MA. 02142*/
X/* ALL RIGHTS RESERVED, COMMERCIAL USAGE STRICTLY PROHIBITED */
X/* WRITTEN BY R. M. SUPNIK */
X
X#include "funcs.h"
X#include "vars.h"
X#include "parse.h"
X
Xstatic logical thisit_ P((integer, integer, integer, integer));
X
X/* THIS ROUTINE DETAILS ON BIT 3 OF PRSFLG */
X
Xinteger getobj_(oidx, aidx, spcobj)
Xinteger oidx;
Xinteger aidx;
Xinteger spcobj;
X{
X    /* System generated locals */
X    integer ret_val, i__1;
X
X    /* Local variables */
X    integer i, av;
X    integer obj;
X    integer nobj;
X    logical chomp;
X
X/* GETOBJ, PAGE 2 */
X
X    chomp = FALSE_;
X    av = advs_1.avehic[play_1.winner - 1];
X    obj = 0;
X/* 						!ASSUME DARK. */
X    if (! lit_(play_1.here)) {
X	goto L200;
X    }
X/* 						!LIT? */
X
X    obj = schlst_(oidx, aidx, play_1.here, 0, 0, spcobj);
X/* 						!SEARCH ROOM. */
X    if (obj < 0) {
X	goto L1000;
X    } else if (obj == 0) {
X	goto L200;
X    } else {
X	goto L100;
X    }
X/* 						!TEST RESULT. */
XL100:
X    if (av == 0 || av == obj || (objcts_1.oflag2[obj - 1] & FINDBT) 
X	    != 0) {
X	goto L200;
X    }
X    if (objcts_1.ocan[obj - 1] == av) {
X	goto L200;
X    }
X/* 						!TEST IF REACHABLE. */
X    chomp = TRUE_;
X/* 						!PROBABLY NOT. */
X
XL200:
X    if (av == 0) {
X	goto L400;
X    }
X/* 						!IN VEHICLE? */
X    nobj = schlst_(oidx, aidx, 0, av, 0, spcobj);
X/* 						!SEARCH VEHICLE. */
X    if (nobj < 0) {
X	goto L1100;
X    } else if (nobj == 0) {
X	goto L400;
X    } else {
X	goto L300;
X    }
X/* 						!TEST RESULT. */
XL300:
X    chomp = FALSE_;
X/* 						!REACHABLE. */
X    if (obj == nobj) {
X	goto L400;
X    }
X/* 						!SAME AS BEFORE? */
X    if (obj != 0) {
X	nobj = -nobj;
X    }
X/* 						!AMB RESULT? */
X    obj = nobj;
X
XL400:
X    nobj = schlst_(oidx, aidx, 0, 0, play_1.winner, spcobj);
X/* 						!SEARCH ADVENTURER. */
X    if (nobj < 0) {
X	goto L1100;
X    } else if (nobj == 0) {
X	goto L600;
X    } else {
X	goto L500;
X    }
X/* 						!TEST RESULT */
XL500:
X    if (obj != 0) {
X	nobj = -nobj;
X    }
X/* 						!AMB RESULT? */
XL1100:
X    obj = nobj;
X/* 						!RETURN NEW OBJECT. */
XL600:
X    if (chomp) {
X	obj = -10000;
X    }
X/* 						!UNREACHABLE. */
XL1000:
X    ret_val = obj;
X
X    if (ret_val != 0) {
X	goto L1500;
X    }
X/* 						!GOT SOMETHING? */
X    i__1 = objcts_1.olnt;
X    for (i = star_1.strbit + 1; i <= i__1; ++i) {
X/* 						!NO, SEARCH GLOBALS. */
X	if (! thisit_(oidx, aidx, i, spcobj)) {
X	    goto L1200;
X	}
X	if (! ghere_(i, play_1.here)) {
X	    goto L1200;
X	}
X/* 						!CAN IT BE HERE? */
X	if (ret_val != 0) {
X	    ret_val = -i;
X	}
X/* 						!AMB MATCH? */
X	if (ret_val == 0) {
X	    ret_val = i;
X	}
XL1200:
X	;
X    }
X
XL1500:
X/* 						!END OF SEARCH. */
X    return ret_val;
X} /* getobj_ */
X
X/* SCHLST--	SEARCH FOR OBJECT */
X
X/* DECLARATIONS */
X
Xinteger schlst_(oidx, aidx, rm, cn, ad, spcobj)
Xinteger oidx;
Xinteger aidx;
Xinteger rm;
Xinteger cn;
Xinteger ad;
Xinteger spcobj;
X{
X    /* System generated locals */
X    integer ret_val, i__1, i__2;
X
X    /* Local variables */
X    integer i, j, x;
X
X    ret_val = 0;
X/* 						!NO RESULT. */
X    i__1 = objcts_1.olnt;
X    for (i = 1; i <= i__1; ++i) {
X/* 						!SEARCH OBJECTS. */
X	if ((objcts_1.oflag1[i - 1] & VISIBT) == 0 || (rm == 0 || ! 
X		qhere_(i, rm)) && (cn == 0 || objcts_1.ocan[i - 1] != cn) 
X		&& (ad == 0 || objcts_1.oadv[i - 1] != ad)) {
X	    goto L1000;
X	}
X	if (! thisit_(oidx, aidx, i, spcobj)) {
X	    goto L200;
X	}
X	if (ret_val != 0) {
X	    goto L2000;
X	}
X/* 						!GOT ONE ALREADY? */
X	ret_val = i;
X/* 						!NO. */
X
X/* IF OPEN OR TRANSPARENT, SEARCH THE OBJECT ITSELF. */
X
XL200:
X	if ((objcts_1.oflag1[i - 1] & TRANBT) == 0 && (
X		objcts_1.oflag2[i - 1] & OPENBT) == 0) {
X	    goto L1000;
X	}
X
X/* SEARCH IS CONDUCTED IN REVERSE.  ALL OBJECTS ARE CHECKED TO */
X/* SEE IF THEY ARE AT SOME LEVEL OF CONTAINMENT INSIDE OBJECT 'I'. */
X/* IF THEY ARE AT LEVEL 1, OR IF ALL LINKS IN THE CONTAINMENT */
X/* CHAIN ARE OPEN, VISIBLE, AND HAVE SEARCHME SET, THEY CAN QUALIFY */
X
X/* AS A POTENTIAL MATCH. */
X
X	i__2 = objcts_1.olnt;
X	for (j = 1; j <= i__2; ++j) {
X/* 						!SEARCH OBJECTS. */
X	    if ((objcts_1.oflag1[j - 1] & VISIBT) == 0 || ! thisit_(
X		    oidx, aidx, j, spcobj)) {
X		goto L500;
X	    }
X	    x = objcts_1.ocan[j - 1];
X/* 						!GET CONTAINER. */
XL300:
X	    if (x == i) {
X		goto L400;
X	    }
X/* 						!INSIDE TARGET? */
X	    if (x == 0) {
X		goto L500;
X	    }
X/* 						!INSIDE ANYTHING? */
X	    if ((objcts_1.oflag1[x - 1] & VISIBT) == 0 || (
X		    objcts_1.oflag1[x - 1] & TRANBT) == 0 && (
X		    objcts_1.oflag2[x - 1] & OPENBT) == 0 || (
X		    objcts_1.oflag2[x - 1] & SCHBT) == 0) {
X		goto L500;
X	    }
X	    x = objcts_1.ocan[x - 1];
X/* 						!GO ANOTHER LEVEL. */
X	    goto L300;
X
XL400:
X	    if (ret_val != 0) {
X		goto L2000;
X	    }
X/* 						!ALREADY GOT ONE? */
X	    ret_val = j;
X/* 						!NO. */
XL500:
X	    ;
X	}
X
XL1000:
X	;
X    }
X    return ret_val;
X
XL2000:
X    ret_val = -ret_val;
X/* 						!AMB RETURN. */
X    return ret_val;
X
X} /* schlst_ */
X
X/* THISIT--	VALIDATE OBJECT VS DESCRIPTION */
X
X/* DECLARATIONS */
X
Xstatic logical thisit_(oidx, aidx, obj, spcobj)
Xinteger oidx;
Xinteger aidx;
Xinteger obj;
Xinteger spcobj;
X{
X    /* Initialized data */
X
X/*    THE FOLLOWING DATA STATEMENT USED RADIX-50 NOTATION (R50MIN/1RA/) */
X
X/*       IN RADIX-50 NOTATION, AN "A" IN THE FIRST POSITION IS */
X/*       ENCODED AS 1*40*40 = 1600. */
X
X    const integer r50min = 1600;
X
X    /* System generated locals */
X    logical ret_val;
X
X    /* Local variables */
X    integer i;
X
X    ret_val = FALSE_;
X/* 						!ASSUME NO MATCH. */
X    if (spcobj != 0 && obj == spcobj) {
X	goto L500;
X    }
X
X/* CHECK FOR OBJECT NAMES */
X
X    i = oidx + 1;
XL100:
X    ++i;
X    if (ovoc[i - 1] <= 0 || ovoc[i - 1] >= r50min) {
X	return ret_val;
X    }
X/* 						!IF DONE, LOSE. */
X    if (ovoc[i - 1] != obj) {
X	goto L100;
X    }
X/* 						!IF FAIL, CONT. */
X
X    if (aidx == 0) {
X	goto L500;
X    }
X/* 						!ANY ADJ? */
X    i = aidx + 1;
XL200:
X    ++i;
X    if (avoc[i - 1] <= 0 || avoc[i - 1] >= r50min) {
X	return ret_val;
X    }
X/* 						!IF DONE, LOSE. */
X    if (avoc[i - 1] != obj) {
X	goto L200;
X    }
X/* 						!IF FAIL, CONT. */
X
XL500:
X    ret_val = TRUE_;
X    return ret_val;
X} /* thisit_ */
END_OF_FILE
if test 6169 -ne `wc -c <'np2.c'`; then
    echo shar: \"'np2.c'\" unpacked with wrong size!
fi
# end of 'np2.c'
fi
if test -f 'supp.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'supp.c'\"
else
echo shar: Extracting \"'supp.c'\" \(4680 characters\)
sed "s/^X//" >'supp.c' <<'END_OF_FILE'
X/* supp.c -- support routines for dungeon */
X
X#include <stdio.h>
X
X#ifdef unix
X#include <sys/types.h>
X#endif
X
X#ifdef BSD4_2
X#include <sys/time.h>
X#else /* ! BSD4_2 */
X#include <time.h>
X#endif /* ! BSD4_2 */
X
X#include "funcs.h"
X
X/* Define these here to avoid using <stdlib.h> */
X
Xextern void exit P((int));
Xextern int rand P((void));
X
X/* We should have a definition for time_t and struct tm by now.  Make
X * sure we have definitions for the functions we want to call.
X * The argument to localtime should be P((const time_t *)), but Ultrix
X * 4.0 leaves out the const in their prototype.  Damn them.
X */
X
Xextern time_t time P((time_t *));
Xextern struct tm *localtime ();
X
X/* Terminate the game */
X
Xvoid exit_()
X{
X    fprintf(stderr, "The game is over.\n");
X    exit(0);
X}
X
X/* Get time in hours, minutes and seconds */
X
Xvoid itime_(hrptr, minptr, secptr)
Xinteger *hrptr;
Xinteger *minptr;
Xinteger *secptr;
X{
X	time_t timebuf;
X	struct tm *tmptr;
X
X	time(&timebuf);
X	tmptr = localtime(&timebuf);
X	
X	*hrptr  = tmptr->tm_hour;
X	*minptr = tmptr->tm_min;
X	*secptr = tmptr->tm_sec;
X}
X
X/* Random number generator */
X
Xinteger rnd_(maxval)
Xinteger maxval;
X{
X	return rand() % maxval;
X}
X
X/* Terminal support routines for dungeon */
X/* By Ian Lance Taylor ian@airs.com or uunet!airs!ian */
X
X/* The dungeon game can often output long strings, more than enough
X * to overwhelm a typical 24 row terminal (I assume that back when
X * dungeon was written people generally used paper terminals (I know
X * I did) so this was not a problem).  The functions in this file
X * provide a very simplistic ``more'' facility.  They are necessarily
X * somewhat operating system dependent, although I have tried to
X * minimize it as much as I could.
X */
X
X/* The following macro definitions may be used to control how these
X * functions work:
X *
X *	MORE_NONE	Don't use the more facility at all
X *	MORE_24		Always assume a 24 row terminal
X *	MORE_TERMCAP	Use termcap routines to get rows of terminal
X *	MORE_TERMINFO	Use terminfo routines to get rows of terminal
X *	MORE_AMOS	Use AMOS monitor calls to get rows of terminal
X *
X * If none of these are defined then this will use termcap routines on
X * unix and AMOS routines on AMOS.
X */
X
X#ifndef MORE_NONE
X#ifndef MORE_24
X#ifndef MORE_TERMCAP
X#ifndef MORE_TERMINFO
X#ifndef MORE_AMOS
X#ifdef __AMOS__
X#define MORE_AMOS
X#else /* ! __AMOS__ */
X#ifdef unix
X#define MORE_TERMCAP
X#else /* ! unix */
X#define MORE_NONE
X#endif /* ! unix */
X#endif /* ! __AMOS__ */
X#endif /* ! MORE_AMOS */
X#endif /* ! MORE_TERMINFO */
X#endif /* ! MORE_TERMCAP */
X#endif /* ! MORE_24 */
X#endif /* ! MORE_NONE */
X
X#ifdef MORE_TERMCAP
X
Xextern char *getenv P((const char *));
Xextern void tgetent P((char *, const char *));
Xextern int tgetnum P((const char *));
X
X#else /* ! MORE_TERMCAP */
X
X#ifdef MORE_TERMINFO
X
X#include <cursesX.h>
X#include <term.h>
Xextern void setupterm P((const char *, int, int));
X
X#else /* ! MORE_TERMINFO */
X
X#ifdef MORE_AMOS
X
X#include <moncal.h>
X#include <unistd.h>
X
X#endif /* MORE_AMOS */
X#endif /* ! MORE_TERMINFO */
X#endif /* ! MORE_TERMCAP */
X
X/* Initialize the more waiting facility (determine how many rows the
X * terminal has).
X */
X
Xstatic integer crows;
Xstatic integer coutput;
X
Xvoid more_init()
X{
X#ifdef MORE_NONE
X
X    crows = 0;
X
X#else /* ! MORE_NONE */
X#ifdef MORE_24
X
X    crows = 24;
X
X#else /* ! MORE_24 */
X#ifdef MORE_TERMCAP
X
X    char buf[2048];
X    char *term;
X
X    term = getenv("TERM");
X    if (term == NULL)
X	crows = 0;
X    else {
X	tgetent(buf, term);
X	crows = tgetnum("li");
X    }
X
X#else /* ! MORE_TERMCAP */
X#ifdef MORE_TERMINFO
X
X    int i;
X
X    setupterm(NULL, 1, &i);
X    if (i != 1)
X        crows = 0;
X    else
X	crows = lines;
X
X#else /* ! MORE_TERMINFO */
X#ifdef MORE_AMOS
X
X    trm_char st;
X
X    if (isatty(fileno(stdin)) == 0)
X	crows = 0;
X    else {
X	    trmchr(&st, 0);
X	    crows = st.row;
X    }
X
X#else /* ! MORE_AMOS */
X
X    This should be impossible
X
X#endif /* ! MORE_AMOS */
X#endif /* ! MORE_TERMINFO */
X#endif /* ! MORE_TERMCAP */
X#endif /* ! MORE_24 */
X#endif /* ! MORE_NONE */
X}
X
X/* The program wants to output a line to the terminal.  If z is not
X * NULL it is a simple string which is output here; otherwise it
X * needs some sort of formatting, and is output after this function
X * returns (if all computers had vprintf I would just it, but they
X * probably don't).
X */
X
Xvoid more_output(z)
Xconst char *z;
X{
X    if (crows > 0  &&  coutput > crows - 2) {
X	printf("Press return to continue: ");
X	(void) fflush(stdout);
X	while (getchar() != '\n')
X	    ;
X	coutput = 0;
X    }
X
X    if (z != NULL)
X	printf("%s\n", z);
X
X    coutput++;
X}
X
X/* The terminal is waiting for input (clear the number of output lines) */
X
Xvoid more_input()
X{
X    coutput = 0;
X}
END_OF_FILE
if test 4680 -ne `wc -c <'supp.c'`; then
    echo shar: \"'supp.c'\" unpacked with wrong size!
fi
# end of 'supp.c'
fi
echo shar: End of archive 11 \(of 12\).
cp /dev/null ark11isdone
MISSING=""
for I in 1 2 3 4 5 6 7 8 9 10 11 12 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked all 12 archives.
    rm -f ark[1-9]isdone ark[1-9][0-9]isdone
else
    echo You still need to unpack the following archives:
    echo "        " ${MISSING}
fi
##  End of shell archive.
exit 0