KNF and WARNS=3
This commit is contained in:
parent
13e5f23389
commit
243d04ef01
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: crc.c,v 1.8 2003/08/07 09:36:50 agc Exp $ */
|
||||
/* $NetBSD: crc.c,v 1.9 2005/07/01 00:03:36 jmc Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1993
|
||||
@ -38,7 +38,7 @@
|
||||
static char sccsid[] = "@(#)crc.c 8.1 (Berkeley) 5/31/93";
|
||||
static char ORIGINAL_sccsid[] = "@(#)crc.c 5.2 (Berkeley) 4/4/91";
|
||||
#else
|
||||
__RCSID("$NetBSD: crc.c,v 1.8 2003/08/07 09:36:50 agc Exp $");
|
||||
__RCSID("$NetBSD: crc.c,v 1.9 2005/07/01 00:03:36 jmc Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -115,10 +115,9 @@ crc_start()
|
||||
crcval = step = 0;
|
||||
}
|
||||
|
||||
/* Process nr bytes at a time; ptr points to them */
|
||||
unsigned long
|
||||
crc(ptr, nr) /* Process nr bytes at a time; ptr points to them */
|
||||
const char *ptr;
|
||||
int nr;
|
||||
crc(const char *ptr, int nr)
|
||||
{
|
||||
int i;
|
||||
const char *p;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: done.c,v 1.8 2003/08/07 09:36:50 agc Exp $ */
|
||||
/* $NetBSD: done.c,v 1.9 2005/07/01 00:03:36 jmc Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1991, 1993
|
||||
@ -39,7 +39,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)done.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: done.c,v 1.8 2003/08/07 09:36:50 agc Exp $");
|
||||
__RCSID("$NetBSD: done.c,v 1.9 2005/07/01 00:03:36 jmc Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -51,7 +51,7 @@ __RCSID("$NetBSD: done.c,v 1.8 2003/08/07 09:36:50 agc Exp $");
|
||||
#include "extern.h"
|
||||
|
||||
int
|
||||
score()
|
||||
score(void)
|
||||
{ /* sort of like 20000 */
|
||||
int scor, i;
|
||||
mxscor = scor = 0;
|
||||
@ -102,9 +102,10 @@ score()
|
||||
return (scor);
|
||||
}
|
||||
|
||||
/* entry=1 means goto 13000 */ /* game is over */
|
||||
/* entry=2 means goto 20000 */ /* 3=19000 */
|
||||
void
|
||||
done(entry) /* entry=1 means goto 13000 */ /* game is over */
|
||||
int entry; /* entry=2 means goto 20000 */ /* 3=19000 */
|
||||
done(int entry)
|
||||
{
|
||||
int i, sc;
|
||||
if (entry == 1)
|
||||
@ -135,10 +136,9 @@ done(entry) /* entry=1 means goto 13000 */ /* game is over */
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
/* label 90 */
|
||||
void
|
||||
die(entry) /* label 90 */
|
||||
int entry;
|
||||
die(int entry)
|
||||
{
|
||||
int i;
|
||||
if (entry != 99) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: hdr.h,v 1.10 2003/08/07 09:36:50 agc Exp $ */
|
||||
/* $NetBSD: hdr.h,v 1.11 2005/07/01 00:03:36 jmc Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1991, 1993
|
||||
@ -83,8 +83,7 @@ extern struct hashtab { /* hash table for vocabulary */
|
||||
} voc[HTSIZE];
|
||||
#define SEED 1815622 /* "Encryption" seed */
|
||||
|
||||
struct text
|
||||
{
|
||||
struct text {
|
||||
char *seekadr;/* Msg start in virtual disk */
|
||||
int txtlen; /* length of msg starting here */
|
||||
};
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: init.c,v 1.14 2003/08/07 09:36:50 agc Exp $ */
|
||||
/* $NetBSD: init.c,v 1.15 2005/07/01 00:03:36 jmc Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1993
|
||||
@ -39,7 +39,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)init.c 8.1 (Berkeley) 6/2/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: init.c,v 1.14 2003/08/07 09:36:50 agc Exp $");
|
||||
__RCSID("$NetBSD: init.c,v 1.15 2005/07/01 00:03:36 jmc Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -57,8 +57,8 @@ __RCSID("$NetBSD: init.c,v 1.14 2003/08/07 09:36:50 agc Exp $");
|
||||
|
||||
int blklin = TRUE;
|
||||
|
||||
int setbit[16] = {1, 2, 4, 010, 020, 040, 0100, 0200, 0400, 01000, 02000, 04000,
|
||||
010000, 020000, 040000, 0100000};
|
||||
int setbit[16] = {1, 2, 4, 010, 020, 040, 0100, 0200, 0400, 01000, 02000,
|
||||
04000, 010000, 020000, 040000, 0100000};
|
||||
|
||||
int datfd; /* message file descriptor */
|
||||
volatile sig_atomic_t delhit;
|
||||
@ -125,8 +125,9 @@ int turns, lmwarn, iwest, knfloc, detail, /* various flags and
|
||||
|
||||
int demo, limit;
|
||||
|
||||
/* everything for 1st time run */
|
||||
void
|
||||
init() /* everything for 1st time run */
|
||||
init(void)
|
||||
{
|
||||
rdata(); /* read data from orig. file */
|
||||
linkdata();
|
||||
@ -134,8 +135,7 @@ init() /* everything for 1st time run */
|
||||
}
|
||||
|
||||
char *
|
||||
decr(a, b, c, d, e)
|
||||
char a, b, c, d, e;
|
||||
decr(int a, int b, int c, int d, int e)
|
||||
{
|
||||
static char buf[6];
|
||||
|
||||
@ -149,7 +149,7 @@ decr(a, b, c, d, e)
|
||||
}
|
||||
|
||||
void
|
||||
linkdata()
|
||||
linkdata(void)
|
||||
{ /* secondary data manipulation */
|
||||
int i, j;
|
||||
|
||||
@ -273,11 +273,9 @@ linkdata()
|
||||
closng = panic = closed = scorng = FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* come here if he hits a del */
|
||||
void
|
||||
trapdel(n) /* come here if he hits a del */
|
||||
int n __attribute__((__unused__));
|
||||
trapdel(int n __attribute__((__unused__)))
|
||||
{
|
||||
delhit = 1; /* main checks, treats as QUIT */
|
||||
signal(SIGINT, trapdel);/* catch subsequent DELs */
|
||||
@ -285,7 +283,7 @@ trapdel(n) /* come here if he hits a del */
|
||||
|
||||
|
||||
void
|
||||
startup()
|
||||
startup(void)
|
||||
{
|
||||
demo = Start();
|
||||
srand((int) (time((time_t *) NULL))); /* random seed */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: io.c,v 1.15 2003/09/19 10:01:53 itojun Exp $ */
|
||||
/* $NetBSD: io.c,v 1.16 2005/07/01 00:03:36 jmc Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1991, 1993
|
||||
@ -39,7 +39,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)io.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: io.c,v 1.15 2003/09/19 10:01:53 itojun Exp $");
|
||||
__RCSID("$NetBSD: io.c,v 1.16 2005/07/01 00:03:36 jmc Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -53,9 +53,10 @@ __RCSID("$NetBSD: io.c,v 1.15 2003/09/19 10:01:53 itojun Exp $");
|
||||
#include "extern.h"
|
||||
|
||||
|
||||
/* get command from user */
|
||||
/* no prompt, usually */
|
||||
void
|
||||
getin(wrd1, wrd2) /* get command from user */
|
||||
char **wrd1, **wrd2; /* no prompt, usually */
|
||||
getin(char **wrd1, char **wrd2)
|
||||
{
|
||||
char *s;
|
||||
static char wd1buf[MAXSTR], wd2buf[MAXSTR];
|
||||
@ -100,9 +101,9 @@ getin(wrd1, wrd2) /* get command from user */
|
||||
}
|
||||
}
|
||||
|
||||
/* confirm with rspeak */
|
||||
int
|
||||
yes(x, y, z) /* confirm with rspeak */
|
||||
int x, y, z;
|
||||
yes(int x, int y, int z)
|
||||
{
|
||||
int result = TRUE; /* pacify gcc */
|
||||
int ch;
|
||||
@ -128,9 +129,9 @@ yes(x, y, z) /* confirm with rspeak */
|
||||
return (result);
|
||||
}
|
||||
|
||||
/* confirm with mspeak */
|
||||
int
|
||||
yesm(x, y, z) /* confirm with mspeak */
|
||||
int x, y, z;
|
||||
yesm(int x, int y, int z)
|
||||
{
|
||||
int result = TRUE; /* pacify gcc */
|
||||
int ch;
|
||||
@ -164,9 +165,10 @@ int outsw = 0; /* putting stuff to data file? */
|
||||
const char iotape[] = "Ax3F'\003tt$8h\315qer*h\017nGKrX\207:!l";
|
||||
const char *tape = iotape; /* pointer to encryption tape */
|
||||
|
||||
/* next virtual char, bump adr */
|
||||
int
|
||||
next()
|
||||
{ /* next virtual char, bump adr */
|
||||
next(void)
|
||||
{
|
||||
int ch;
|
||||
|
||||
ch = (*inptr ^ random()) & 0xFF; /* Decrypt input data */
|
||||
@ -181,9 +183,10 @@ next()
|
||||
|
||||
char breakch; /* tell which char ended rnum */
|
||||
|
||||
/* "read" data from virtual file */
|
||||
void
|
||||
rdata()
|
||||
{ /* "read" data from virtual file */
|
||||
rdata(void)
|
||||
{
|
||||
int sect;
|
||||
char ch;
|
||||
|
||||
@ -257,10 +260,10 @@ rdata()
|
||||
|
||||
char nbf[12];
|
||||
|
||||
|
||||
/* read initial location num */
|
||||
int
|
||||
rnum()
|
||||
{ /* read initial location num */
|
||||
rnum(void)
|
||||
{
|
||||
char *s;
|
||||
tape = iotape; /* restart encryption tape */
|
||||
for (s = nbf, *s = 0;; s++)
|
||||
@ -275,9 +278,9 @@ rnum()
|
||||
|
||||
char *seekhere;
|
||||
|
||||
/* read description-format msgs */
|
||||
void
|
||||
rdesc(sect) /* read description-format msgs */
|
||||
int sect;
|
||||
rdesc(int sect)
|
||||
{
|
||||
int locc;
|
||||
char *seekstart, *maystart;
|
||||
@ -287,7 +290,8 @@ rdesc(sect) /* read description-format msgs */
|
||||
for (oldloc = -1, seekstart = seekhere;;) {
|
||||
maystart = inptr; /* maybe starting new entry */
|
||||
if ((locc = rnum()) != oldloc && oldloc >= 0 /* finished msg */
|
||||
&& !(sect == 5 && (locc == 0 || locc >= 100))) { /* unless sect 5 */
|
||||
/* unless sect 5 */
|
||||
&& !(sect == 5 && (locc == 0 || locc >= 100))) {
|
||||
switch (sect) { /* now put it into right table */
|
||||
case 1:/* long descriptions */
|
||||
ltext[oldloc].seekadr = seekhere;
|
||||
@ -337,9 +341,10 @@ rdesc(sect) /* read description-format msgs */
|
||||
}
|
||||
}
|
||||
|
||||
/* read travel table */
|
||||
void
|
||||
rtrav()
|
||||
{ /* read travel table */
|
||||
rtrav(void)
|
||||
{
|
||||
int locc;
|
||||
struct travlist *t = NULL;
|
||||
char *s;
|
||||
@ -347,7 +352,8 @@ rtrav()
|
||||
int len, m, n, entries = 0;
|
||||
|
||||
for (oldloc = -1;;) { /* get another line */
|
||||
if ((locc = rnum()) != oldloc && oldloc >= 0) { /* end of entry */
|
||||
/* end of entry */
|
||||
if ((locc = rnum()) != oldloc && oldloc >= 0) {
|
||||
t->next = 0; /* terminate the old entry */
|
||||
/* printf("%d:%d entries\n",oldloc,entries); */
|
||||
/* twrite(oldloc); */
|
||||
@ -355,7 +361,8 @@ rtrav()
|
||||
if (locc == -1)
|
||||
return;
|
||||
if (locc != oldloc) { /* getting a new entry */
|
||||
t = travel[locc] = (struct travlist *) malloc(sizeof(struct travlist));
|
||||
t = travel[locc] = (struct travlist *)
|
||||
malloc(sizeof(struct travlist));
|
||||
if ( t == NULL)
|
||||
err(1, NULL);
|
||||
/* printf("New travel list for %d\n",locc); */
|
||||
@ -378,7 +385,8 @@ rtrav()
|
||||
}
|
||||
while (breakch != LF) { /* only do one line at a time */
|
||||
if (entries++) {
|
||||
t = t->next = (struct travlist *) malloc(sizeof(struct travlist));
|
||||
t = t->next = (struct travlist *)
|
||||
malloc(sizeof(struct travlist));
|
||||
if (t == NULL)
|
||||
err(1, NULL);
|
||||
}
|
||||
@ -391,9 +399,9 @@ rtrav()
|
||||
}
|
||||
#ifdef DEBUG
|
||||
|
||||
/* travel options from this loc */
|
||||
void
|
||||
twrite(loq) /* travel options from this loc */
|
||||
int loq;
|
||||
twrite(int loq)
|
||||
{
|
||||
struct travlist *t;
|
||||
printf("If");
|
||||
@ -413,15 +421,16 @@ twrite(loq) /* travel options from this loc */
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
|
||||
/* read the vocabulary */
|
||||
void
|
||||
rvoc()
|
||||
rvoc(void)
|
||||
{
|
||||
char *s; /* read the vocabulary */
|
||||
int index;
|
||||
char *s;
|
||||
int idx;
|
||||
char buf[6];
|
||||
for (;;) {
|
||||
index = rnum();
|
||||
if (index < 0)
|
||||
idx = rnum();
|
||||
if (idx < 0)
|
||||
break;
|
||||
for (s = buf, *s = 0;; s++) /* get the word */
|
||||
if ((*s = next()) == TAB || *s == '\n' || *s == LF
|
||||
@ -431,16 +440,16 @@ rvoc()
|
||||
if (*s != '\n' && *s != LF)
|
||||
FLUSHLF;/* can be comments */
|
||||
*s = 0;
|
||||
/* printf("\"%s\"=%d\n",buf,index); */
|
||||
vocab(buf, -2, index);
|
||||
/* printf("\"%s\"=%d\n",buf,idx); */
|
||||
vocab(buf, -2, idx);
|
||||
}
|
||||
/* prht(); */
|
||||
}
|
||||
|
||||
|
||||
/* initial object locations */
|
||||
void
|
||||
rlocs()
|
||||
{ /* initial object locations */
|
||||
rlocs(void)
|
||||
{
|
||||
for (;;) {
|
||||
if ((obj = rnum()) < 0)
|
||||
break;
|
||||
@ -452,9 +461,10 @@ rlocs()
|
||||
}
|
||||
}
|
||||
|
||||
/* default verb messages */
|
||||
void
|
||||
rdflt()
|
||||
{ /* default verb messages */
|
||||
rdflt(void)
|
||||
{
|
||||
for (;;) {
|
||||
if ((verb = rnum()) < 0)
|
||||
break;
|
||||
@ -462,9 +472,10 @@ rdflt()
|
||||
}
|
||||
}
|
||||
|
||||
/* liquid assets &c: cond bits */
|
||||
void
|
||||
rliq()
|
||||
{ /* liquid assets &c: cond bits */
|
||||
rliq(void)
|
||||
{
|
||||
int bitnum;
|
||||
for (;;) { /* read new bit list */
|
||||
if ((bitnum = rnum()) < 0)
|
||||
@ -478,7 +489,7 @@ rliq()
|
||||
}
|
||||
|
||||
void
|
||||
rhints()
|
||||
rhints(void)
|
||||
{
|
||||
int hintnum, i;
|
||||
hntmax = 0;
|
||||
@ -494,8 +505,7 @@ rhints()
|
||||
|
||||
|
||||
void
|
||||
rspeak(msg)
|
||||
int msg;
|
||||
rspeak(int msg)
|
||||
{
|
||||
if (msg != 0)
|
||||
speak(&rtext[msg]);
|
||||
@ -503,19 +513,17 @@ rspeak(msg)
|
||||
|
||||
|
||||
void
|
||||
mspeak(msg)
|
||||
int msg;
|
||||
mspeak(int msg)
|
||||
{
|
||||
if (msg != 0)
|
||||
speak(&mtext[msg]);
|
||||
}
|
||||
|
||||
|
||||
/* read, decrypt, and print a message (not ptext) */
|
||||
/* msg is a pointer to seek address and length of mess */
|
||||
void
|
||||
speak(msg) /* read, decrypt, and print a message (not
|
||||
* ptext) */
|
||||
const struct text *msg; /* msg is a pointer to seek address and length
|
||||
* of mess */
|
||||
speak(const struct text *msg)
|
||||
{
|
||||
char *s, nonfirst;
|
||||
|
||||
@ -540,16 +548,14 @@ speak(msg) /* read, decrypt, and print a message (not
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* read, decrypt and print a ptext message */
|
||||
/* msg is the number of all the p msgs for this place */
|
||||
/* assumes object 1 doesn't have prop 1, obj 2 no prop 2 &c */
|
||||
void
|
||||
pspeak(m, skip) /* read, decrypt an print a ptext message */
|
||||
int m; /* msg is the number of all the p msgs for
|
||||
* this place */
|
||||
int skip; /* assumes object 1 doesn't have prop 1, obj 2
|
||||
* no prop 2 &c */
|
||||
pspeak(int m, int skip)
|
||||
{
|
||||
char *s, nonfirst;
|
||||
char *numst, save;
|
||||
char *numst;
|
||||
struct text *msg;
|
||||
char *tbuf;
|
||||
|
||||
@ -564,7 +570,7 @@ pspeak(m, skip) /* read, decrypt an print a ptext message */
|
||||
tape = iotape; /* restart decryption tape */
|
||||
for (numst = s; (*s ^= *tape++) != TAB; s++); /* get number */
|
||||
|
||||
save = *s; /* Temporarily trash the string (cringe) */
|
||||
/* Temporarily trash the string (cringe) */
|
||||
*s++ = 0; /* decrypting number within the string */
|
||||
|
||||
if (atoi(numst) != 100 * skip && skip >= 0) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: main.c,v 1.18 2004/01/27 20:30:28 jsm Exp $ */
|
||||
/* $NetBSD: main.c,v 1.19 2005/07/01 00:03:36 jmc Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1991, 1993
|
||||
@ -44,7 +44,7 @@ __COPYRIGHT("@(#) Copyright (c) 1991, 1993\n\
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/2/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: main.c,v 1.18 2004/01/27 20:30:28 jsm Exp $");
|
||||
__RCSID("$NetBSD: main.c,v 1.19 2005/07/01 00:03:36 jmc Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -59,12 +59,8 @@ __RCSID("$NetBSD: main.c,v 1.18 2004/01/27 20:30:28 jsm Exp $");
|
||||
#include "hdr.h"
|
||||
#include "extern.h"
|
||||
|
||||
int main(int, char **);
|
||||
|
||||
int
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
int i;
|
||||
int rval, ll;
|
||||
@ -411,7 +407,8 @@ l4080:
|
||||
if (place[eggs] == plac[eggs]
|
||||
|| (toting(eggs) && loc == plac[eggs]))
|
||||
goto l2011;
|
||||
if (place[eggs] == 0 && place[troll] == 0 && prop[troll] == 0)
|
||||
if (place[eggs] == 0 && place[troll] == 0 &&
|
||||
prop[troll] == 0)
|
||||
prop[troll] = 1;
|
||||
k = 2;
|
||||
if (here(eggs))
|
||||
@ -595,9 +592,9 @@ l4090:
|
||||
case 14: /* 9140 - eat */
|
||||
if (obj == food)
|
||||
goto l8142;
|
||||
if (obj == bird || obj == snake || obj == clam || obj == oyster
|
||||
|| obj == dwarf || obj == dragon || obj == troll
|
||||
|| obj == bear)
|
||||
if (obj == bird || obj == snake || obj == clam
|
||||
|| obj == oyster || obj == dwarf || obj == dragon
|
||||
|| obj == troll || obj == bear)
|
||||
spk = 71;
|
||||
goto l2011;
|
||||
l9150: case 15:/* 9150 - drink */
|
||||
@ -637,7 +634,8 @@ l4090:
|
||||
|| k == liqloc(loc))
|
||||
spk = 94;
|
||||
for (i = 1; i <= 5; i++)
|
||||
if (dloc[i] == loc && dflag >= 2 && obj == dwarf)
|
||||
if (dloc[i] == loc && dflag >= 2
|
||||
&& obj == dwarf)
|
||||
spk = 94;
|
||||
if (closed)
|
||||
spk = 138;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: save.c,v 1.8 2003/08/07 09:36:51 agc Exp $ */
|
||||
/* $NetBSD: save.c,v 1.9 2005/07/01 00:03:36 jmc Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1991, 1993
|
||||
@ -39,7 +39,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)save.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: save.c,v 1.8 2003/08/07 09:36:51 agc Exp $");
|
||||
__RCSID("$NetBSD: save.c,v 1.9 2005/07/01 00:03:36 jmc Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -120,11 +120,10 @@ struct savestruct save_array[] =
|
||||
{NULL, 0}
|
||||
};
|
||||
|
||||
/* Two passes on data: first to get checksum, second */
|
||||
/* to output the data using checksum to start random #s */
|
||||
int
|
||||
save(outfile) /* Two passes on data: first to get checksum,
|
||||
* second */
|
||||
const char *outfile; /* to output the data using checksum to start
|
||||
* random #s */
|
||||
save(const char *outfile)
|
||||
{
|
||||
FILE *out;
|
||||
struct savestruct *p;
|
||||
@ -157,8 +156,7 @@ save(outfile) /* Two passes on data: first to get checksum,
|
||||
}
|
||||
|
||||
int
|
||||
restore(infile)
|
||||
const char *infile;
|
||||
restore(const char *infile)
|
||||
{
|
||||
FILE *in;
|
||||
struct savestruct *p;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: setup.c,v 1.10 2003/08/07 09:36:51 agc Exp $ */
|
||||
/* $NetBSD: setup.c,v 1.11 2005/07/01 00:03:36 jmc Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1991, 1993
|
||||
@ -39,7 +39,7 @@ static char copyright[] = "@(#) Copyright (c) 1991, 1993\n\
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)setup.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: setup.c,v 1.10 2003/08/07 09:36:51 agc Exp $";
|
||||
static char rcsid[] = "$NetBSD: setup.c,v 1.11 2005/07/01 00:03:36 jmc Exp $";
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -72,9 +72,7 @@ static char rcsid[] = "$NetBSD: setup.c,v 1.10 2003/08/07 09:36:51 agc Exp $";
|
||||
int main(int, char *[]);
|
||||
|
||||
int
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
FILE *infile;
|
||||
int c, count, linestart;
|
||||
@ -100,7 +98,8 @@ main(argc, argv)
|
||||
|
||||
while ((c = getc(infile)) != EOF) {
|
||||
if (linestart && c == ' ') { /* Convert first spaces to tab */
|
||||
printf("0x%02x,", (unsigned int)('\t' ^ random()) & 0xFF);
|
||||
printf("0x%02x,",
|
||||
(unsigned int)('\t' ^ random()) & 0xFF);
|
||||
while ((c = getc(infile)) == ' ' && c != EOF);
|
||||
/* Drop the non-whitespace character through */
|
||||
linestart = NO;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: subr.c,v 1.10 2003/08/07 09:36:51 agc Exp $ */
|
||||
/* $NetBSD: subr.c,v 1.11 2005/07/01 00:03:36 jmc Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1991, 1993
|
||||
@ -39,7 +39,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)subr.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: subr.c,v 1.10 2003/08/07 09:36:51 agc Exp $");
|
||||
__RCSID("$NetBSD: subr.c,v 1.11 2005/07/01 00:03:36 jmc Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -52,8 +52,7 @@ __RCSID("$NetBSD: subr.c,v 1.10 2003/08/07 09:36:51 agc Exp $");
|
||||
|
||||
/* Statement functions */
|
||||
int
|
||||
toting(objj)
|
||||
int objj;
|
||||
toting(int objj)
|
||||
{
|
||||
if (place[objj] == -1)
|
||||
return (TRUE);
|
||||
@ -62,8 +61,7 @@ toting(objj)
|
||||
}
|
||||
|
||||
int
|
||||
here(objj)
|
||||
int objj;
|
||||
here(int objj)
|
||||
{
|
||||
if (place[objj] == loc || toting(objj))
|
||||
return (TRUE);
|
||||
@ -72,8 +70,7 @@ here(objj)
|
||||
}
|
||||
|
||||
int
|
||||
at(objj)
|
||||
int objj;
|
||||
at(int objj)
|
||||
{
|
||||
if (place[objj] == loc || fixed[objj] == loc)
|
||||
return (TRUE);
|
||||
@ -82,14 +79,13 @@ at(objj)
|
||||
}
|
||||
|
||||
int
|
||||
liq2(pbotl)
|
||||
int pbotl;
|
||||
liq2(int pbotl)
|
||||
{
|
||||
return ((1 - pbotl) * water + (pbotl / 2) * (water + oil));
|
||||
}
|
||||
|
||||
int
|
||||
liq()
|
||||
liq(void)
|
||||
{
|
||||
int i;
|
||||
i = prop[bottle];
|
||||
@ -99,9 +95,9 @@ liq()
|
||||
return (liq2(-1 - i));
|
||||
}
|
||||
|
||||
/* may want to clean this one up a bit */
|
||||
int
|
||||
liqloc(locc) /* may want to clean this one up a bit */
|
||||
int locc;
|
||||
liqloc(int locc)
|
||||
{
|
||||
int i, j, l;
|
||||
i = cond[locc] / 2;
|
||||
@ -112,8 +108,7 @@ liqloc(locc) /* may want to clean this one up a bit */
|
||||
}
|
||||
|
||||
int
|
||||
bitset(l, n)
|
||||
int l, n;
|
||||
bitset(int l, int n)
|
||||
{
|
||||
if (cond[l] & setbit[n])
|
||||
return (TRUE);
|
||||
@ -121,8 +116,7 @@ bitset(l, n)
|
||||
}
|
||||
|
||||
int
|
||||
forced(locc)
|
||||
int locc;
|
||||
forced(int locc)
|
||||
{
|
||||
if (cond[locc] == 2)
|
||||
return (TRUE);
|
||||
@ -130,7 +124,7 @@ forced(locc)
|
||||
}
|
||||
|
||||
int
|
||||
dark()
|
||||
dark(void)
|
||||
{
|
||||
if ((cond[loc] % 2) == 0 && (prop[lamp] == 0 || !here(lamp)))
|
||||
return (TRUE);
|
||||
@ -138,8 +132,7 @@ dark()
|
||||
}
|
||||
|
||||
int
|
||||
pct(n)
|
||||
int n;
|
||||
pct(int n)
|
||||
{
|
||||
if (ran(100) < n)
|
||||
return (TRUE);
|
||||
@ -148,7 +141,7 @@ pct(n)
|
||||
|
||||
|
||||
int
|
||||
fdwarf()
|
||||
fdwarf(void)
|
||||
{ /* 71 */
|
||||
int i, j;
|
||||
struct travlist *kk;
|
||||
@ -209,7 +202,8 @@ fdwarf()
|
||||
j = 1 + ran(j);
|
||||
odloc[i] = dloc[i];
|
||||
dloc[i] = tk[j];
|
||||
dseen[i] = (dseen[i] && loc >= 15) || (dloc[i] == loc || odloc[i] == loc);
|
||||
dseen[i] = (dseen[i] && loc >= 15) ||
|
||||
(dloc[i] == loc || odloc[i] == loc);
|
||||
if (!dseen[i])
|
||||
continue; /* i.e. goto 6030 */
|
||||
dloc[i] = loc;
|
||||
@ -293,9 +287,10 @@ l82: if (stick <= 1) { /* 82 */
|
||||
}
|
||||
|
||||
|
||||
/* label 8 */
|
||||
int
|
||||
march()
|
||||
{ /* label 8 */
|
||||
march(void)
|
||||
{
|
||||
int ll1, ll2;
|
||||
|
||||
if ((tkk = travel[newloc = loc]) == 0)
|
||||
@ -377,11 +372,10 @@ l12: /* alternative to probability move */
|
||||
goto l11;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* 20 */
|
||||
int
|
||||
mback()
|
||||
{ /* 20 */
|
||||
mback(void)
|
||||
{
|
||||
struct travlist *tk2, *j;
|
||||
int ll;
|
||||
if (forced(k = oldloc))
|
||||
@ -416,10 +410,10 @@ mback()
|
||||
return (2);
|
||||
}
|
||||
|
||||
|
||||
/* 30000 */
|
||||
int
|
||||
specials()
|
||||
{ /* 30000 */
|
||||
specials(void)
|
||||
{
|
||||
switch (newloc -= 300) {
|
||||
case 1: /* 30100 */
|
||||
newloc = 99 + 100 - loc;
|
||||
@ -438,10 +432,10 @@ specials()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* 30300 */
|
||||
int
|
||||
trbridge()
|
||||
{ /* 30300 */
|
||||
trbridge(void)
|
||||
{
|
||||
if (prop[troll] == 1) {
|
||||
pspeak(troll, 1);
|
||||
prop[troll] = 0;
|
||||
@ -470,10 +464,10 @@ trbridge()
|
||||
return (99);
|
||||
}
|
||||
|
||||
|
||||
/* 20 */
|
||||
void
|
||||
badmove()
|
||||
{ /* 20 */
|
||||
badmove(void)
|
||||
{
|
||||
spk = 12;
|
||||
if (k >= 43 && k <= 50)
|
||||
spk = 9;
|
||||
@ -493,17 +487,16 @@ badmove()
|
||||
}
|
||||
|
||||
void
|
||||
bug(n)
|
||||
int n;
|
||||
bug(int n)
|
||||
{
|
||||
printf("Please tell jim@rand.org that fatal bug %d happened.\n", n);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
/* 2600 &c */
|
||||
void
|
||||
checkhints()
|
||||
{ /* 2600 &c */
|
||||
checkhints(void)
|
||||
{
|
||||
int hint;
|
||||
for (hint = 4; hint <= hntmax; hint++) {
|
||||
if (hinted[hint])
|
||||
@ -550,10 +543,10 @@ l40020: hintlc[hint] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* 9030 */
|
||||
int
|
||||
trsay()
|
||||
{ /* 9030 */
|
||||
trsay(void)
|
||||
{
|
||||
int i;
|
||||
if (*wd2 != 0)
|
||||
copystr(wd2, wd1);
|
||||
@ -567,10 +560,10 @@ trsay()
|
||||
return (2012);
|
||||
}
|
||||
|
||||
|
||||
/* 9010 */
|
||||
int
|
||||
trtake()
|
||||
{ /* 9010 */
|
||||
trtake(void)
|
||||
{
|
||||
if (toting(obj))
|
||||
return (2011); /* 9010 */
|
||||
spk = 25;
|
||||
@ -622,10 +615,10 @@ l9014: if ((obj == bird || obj == cage) && prop[bird] != 0)
|
||||
return (2009);
|
||||
}
|
||||
|
||||
|
||||
/* 9021 */
|
||||
int
|
||||
dropper()
|
||||
{ /* 9021 */
|
||||
dropper(void)
|
||||
{
|
||||
k = liq();
|
||||
if (k == obj)
|
||||
obj = bottle;
|
||||
@ -639,9 +632,10 @@ dropper()
|
||||
return (2012);
|
||||
}
|
||||
|
||||
/* 9020 */
|
||||
int
|
||||
trdrop()
|
||||
{ /* 9020 */
|
||||
trdrop(void)
|
||||
{
|
||||
if (toting(rod2) && obj == rod && !toting(rod))
|
||||
obj = rod2;
|
||||
if (!toting(obj))
|
||||
@ -691,10 +685,10 @@ trdrop()
|
||||
return (dropper());
|
||||
}
|
||||
|
||||
|
||||
/* 9040 */
|
||||
int
|
||||
tropen()
|
||||
{ /* 9040 */
|
||||
tropen(void)
|
||||
{
|
||||
if (obj == clam || obj == oyster) {
|
||||
k = 0; /* 9046 */
|
||||
if (obj == oyster)
|
||||
@ -769,10 +763,10 @@ tropen()
|
||||
return (2010);
|
||||
}
|
||||
|
||||
|
||||
/* 9120 */
|
||||
int
|
||||
trkill()
|
||||
{ /* 9120 */
|
||||
trkill(void)
|
||||
{
|
||||
int i;
|
||||
for (i = 1; i <= 5; i++)
|
||||
if (dloc[i] == loc && dflag >= 2)
|
||||
@ -851,10 +845,10 @@ trkill()
|
||||
return (8);
|
||||
}
|
||||
|
||||
|
||||
/* 9170: throw */
|
||||
int
|
||||
trtoss()
|
||||
{ /* 9170: throw */
|
||||
trtoss(void)
|
||||
{
|
||||
int i;
|
||||
if (toting(rod2) && obj == rod && !toting(rod))
|
||||
obj = rod2;
|
||||
@ -913,10 +907,10 @@ trtoss()
|
||||
return (9120);
|
||||
}
|
||||
|
||||
|
||||
/* 9210 */
|
||||
int
|
||||
trfeed()
|
||||
{ /* 9210 */
|
||||
trfeed(void)
|
||||
{
|
||||
if (obj == bird) {
|
||||
spk = 100;
|
||||
return (2011);
|
||||
@ -960,10 +954,10 @@ trfeed()
|
||||
return (2011);
|
||||
}
|
||||
|
||||
|
||||
/* 9220 */
|
||||
int
|
||||
trfill()
|
||||
{ /* 9220 */
|
||||
trfill(void)
|
||||
{
|
||||
if (obj == vase) {
|
||||
spk = 29;
|
||||
if (liqloc(loc) == 0)
|
||||
@ -995,10 +989,10 @@ trfill()
|
||||
return (2011);
|
||||
}
|
||||
|
||||
|
||||
/* 10000 */
|
||||
void
|
||||
closing()
|
||||
{ /* 10000 */
|
||||
closing(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
prop[grate] = prop[fissur] = 0;
|
||||
@ -1022,10 +1016,10 @@ closing()
|
||||
closng = TRUE;
|
||||
}
|
||||
|
||||
|
||||
/* 11000 */
|
||||
void
|
||||
caveclose()
|
||||
{ /* 11000 */
|
||||
caveclose(void)
|
||||
{
|
||||
int i;
|
||||
prop[bottle] = put(bottle, 115, 1);
|
||||
prop[plant] = put(plant, 115, 0);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: vocab.c,v 1.11 2003/08/07 09:36:51 agc Exp $ */
|
||||
/* $NetBSD: vocab.c,v 1.12 2005/07/01 00:03:36 jmc Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1991, 1993
|
||||
@ -39,7 +39,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)vocab.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: vocab.c,v 1.11 2003/08/07 09:36:51 agc Exp $");
|
||||
__RCSID("$NetBSD: vocab.c,v 1.12 2005/07/01 00:03:36 jmc Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -52,15 +52,13 @@ __RCSID("$NetBSD: vocab.c,v 1.11 2003/08/07 09:36:51 agc Exp $");
|
||||
#include "extern.h"
|
||||
|
||||
void
|
||||
dstroy(object)
|
||||
int object;
|
||||
dstroy(int object)
|
||||
{
|
||||
move(object, 0);
|
||||
}
|
||||
|
||||
void
|
||||
juggle(object)
|
||||
int object;
|
||||
juggle(int object)
|
||||
{
|
||||
int i, j;
|
||||
|
||||
@ -70,10 +68,8 @@ juggle(object)
|
||||
move(object + 100, j);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
move(object, where)
|
||||
int object, where;
|
||||
move(int object, int where)
|
||||
{
|
||||
int from;
|
||||
|
||||
@ -87,16 +83,14 @@ move(object, where)
|
||||
}
|
||||
|
||||
int
|
||||
put(object, where, pval)
|
||||
int object, where, pval;
|
||||
put(int object, int where, int pval)
|
||||
{
|
||||
move(object, where);
|
||||
return (-1 - pval);
|
||||
}
|
||||
|
||||
void
|
||||
carry(object, where)
|
||||
int object, where;
|
||||
carry(int object, int where)
|
||||
{
|
||||
int temp;
|
||||
|
||||
@ -116,8 +110,7 @@ carry(object, where)
|
||||
|
||||
|
||||
void
|
||||
drop(object, where)
|
||||
int object, where;
|
||||
drop(int object, int where)
|
||||
{
|
||||
if (object > 100)
|
||||
fixed[object - 100] = where;
|
||||
@ -132,12 +125,11 @@ drop(object, where)
|
||||
atloc[where] = object;
|
||||
}
|
||||
|
||||
/* look up or store a word */
|
||||
/* -2 for store, -1 for user word, >=0 for canned lookup */
|
||||
/* used for storing only */
|
||||
int
|
||||
vocab(word, type, value) /* look up or store a word */
|
||||
const char *word;
|
||||
int type; /* -2 for store, -1 for user word, >=0 for
|
||||
* canned lookup */
|
||||
int value; /* used for storing only */
|
||||
vocab(const char *word, int type, int value)
|
||||
{
|
||||
int adr;
|
||||
const char *s;
|
||||
@ -197,9 +189,10 @@ exitloop2: /* hashed entry does not match */
|
||||
}
|
||||
}
|
||||
|
||||
/* print hash table */
|
||||
void
|
||||
prht()
|
||||
{ /* print hash table */
|
||||
prht(void)
|
||||
{
|
||||
int i, j, l;
|
||||
char *c;
|
||||
struct hashtab *h;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: wizard.c,v 1.11 2003/08/07 09:36:51 agc Exp $ */
|
||||
/* $NetBSD: wizard.c,v 1.12 2005/07/01 00:03:36 jmc Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1991, 1993
|
||||
@ -39,7 +39,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)wizard.c 8.1 (Berkeley) 6/2/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: wizard.c,v 1.11 2003/08/07 09:36:51 agc Exp $");
|
||||
__RCSID("$NetBSD: wizard.c,v 1.12 2005/07/01 00:03:36 jmc Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -53,8 +53,7 @@ __RCSID("$NetBSD: wizard.c,v 1.11 2003/08/07 09:36:51 agc Exp $");
|
||||
#include "extern.h"
|
||||
|
||||
void
|
||||
datime(d, t)
|
||||
int *d, *t;
|
||||
datime(int *d, int *t)
|
||||
{
|
||||
time_t tvec;
|
||||
struct tm *tptr;
|
||||
@ -75,14 +74,14 @@ datime(d, t)
|
||||
char magic[6];
|
||||
|
||||
void
|
||||
poof()
|
||||
poof(void)
|
||||
{
|
||||
strcpy(magic, DECR('d', 'w', 'a', 'r', 'f'));
|
||||
latncy = 45;
|
||||
}
|
||||
|
||||
int
|
||||
Start()
|
||||
Start(void)
|
||||
{
|
||||
int d, t, delay;
|
||||
|
||||
@ -109,9 +108,10 @@ Start()
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
/* not as complex as advent/10 (for now) */
|
||||
int
|
||||
wizard()
|
||||
{ /* not as complex as advent/10 (for now) */
|
||||
wizard(void)
|
||||
{
|
||||
char *word, *x;
|
||||
if (!yesm(16, 0, 7))
|
||||
return (FALSE);
|
||||
@ -126,7 +126,7 @@ wizard()
|
||||
}
|
||||
|
||||
void
|
||||
ciao()
|
||||
ciao(void)
|
||||
{
|
||||
char *c;
|
||||
char fname[80];
|
||||
@ -144,14 +144,14 @@ ciao()
|
||||
if (save(fname) != 0)
|
||||
return; /* Save failed */
|
||||
printf("To resume, say \"adventure %s\".\n", fname);
|
||||
printf("\"With these rooms I might now have been familiarly acquainted.\"\n");
|
||||
printf("\"With these rooms I might now have been familiarly ");
|
||||
printf("acquainted.\"\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
ran(range)
|
||||
int range;
|
||||
ran(int range)
|
||||
{
|
||||
long i;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user