convert from KNR to ANSI function declarations

Reviewed by:	md5(1)
This commit is contained in:
Bill Fumerola 2002-02-23 09:53:27 +00:00
parent e9a44dbc83
commit b30325de41
9 changed files with 92 additions and 114 deletions

View File

@ -113,14 +113,14 @@ u_long crcval;
u_int step; u_int step;
void void
crc_start() crc_start(void)
{ {
crcval = step = 0; crcval = step = 0;
} }
u_long crc(ptr, nr) /* Process nr bytes at a time; ptr points to them */ /* Process nr bytes at a time; ptr points to them */
const char *ptr; u_long
int nr; crc(const char *ptr, int nr)
{ {
int i; int i;
const char *p; const char *p;

View File

@ -51,7 +51,7 @@ static const char rcsid[] =
#include "hdr.h" #include "hdr.h"
int int
score() /* sort of like 20000 */ score(void) /* sort of like 20000 */
{ int scor,i; { int scor,i;
mxscor=scor=0; mxscor=scor=0;
for (i=50; i<=maxtrs; i++) for (i=50; i<=maxtrs; i++)
@ -87,9 +87,10 @@ score() /* sort of like 20000 */
return(scor); return(scor);
} }
/* entry=1 means goto 13000 */ /* game is over */
/* entry=2 means goto 20000 */ /* 3=19000 */
void void
done(entry) /* entry=1 means goto 13000 */ /* game is over */ done(int entry)
int entry; /* entry=2 means goto 20000 */ /* 3=19000 */
{ int i,sc; { int i,sc;
if (entry==1) mspeak(1); if (entry==1) mspeak(1);
if (entry==3) rspeak(136); if (entry==3) rspeak(136);
@ -117,8 +118,7 @@ int entry; /* entry=2 means goto 20000 */ /* 3=19000 */
void void
die(entry) /* label 90 */ die(int entry) /* label 90 */
int entry;
{ int i; { int i;
if (entry != 99) if (entry != 99)
{ rspeak(23); { rspeak(23);

View File

@ -171,7 +171,8 @@ u_long crc (const char *ptr, int nr);
void crc_start (void); void crc_start (void);
int dark (void); int dark (void);
void datime (int *d, int *t); void datime (int *d, int *t);
char *decr (int, int, int, int, int); char *decr (const unsigned char, const unsigned char, const unsigned char,
const unsigned char, const unsigned char);
void die (int entry); void die (int entry);
void done (int entry); void done (int entry);
void drop (int object,int where); void drop (int object,int where);

View File

@ -60,15 +60,16 @@ int setbit[16] = {1,2,4,010,020,040,0100,0200,0400,01000,02000,04000,
static void linkdata (void); static void linkdata (void);
void void
init() /* everything for 1st time run */ init(void) /* everything for 1st time run */
{ {
rdata(); /* read data from orig. file */ rdata(); /* read data from orig. file */
linkdata(); linkdata();
poof(); poof();
} }
char *decr(a,b,c,d,e) char *
const unsigned char a,b,c,d,e; decr(const unsigned char a, const unsigned char b, const unsigned char c,
const unsigned char d, const unsigned char e)
{ {
static char buf[6]; static char buf[6];
@ -82,7 +83,7 @@ const unsigned char a,b,c,d,e;
} }
static void static void
linkdata() /* secondary data manipulation */ linkdata(void) /* secondary data manipulation */
{ int i,j; { int i,j;
/* array linkages */ /* array linkages */
@ -204,8 +205,7 @@ linkdata() /* secondary data manipulation */
void void
trapdel(sig) /* come here if he hits a del */ trapdel(int sig) /* come here if he hits a del */
int sig;
{ {
sig = 0; sig = 0;
delhit = 1; /* main checks, treats as QUIT */ delhit = 1; /* main checks, treats as QUIT */
@ -214,7 +214,7 @@ int sig;
void void
startup() startup(void)
{ {
demo=Start(); demo=Start();
srandomdev(); srandomdev();

View File

@ -65,9 +65,10 @@ static void rvoc (void);
static void twrite (int); static void twrite (int);
#endif #endif
/* get command from user */
/* no prompt, usually */
void void
getin(wrd1,wrd2) /* get command from user */ getin(char **wrd1, char **wrd2)
char **wrd1,**wrd2; /* no prompt, usually */
{ char *s; { char *s;
static char wd1buf[MAXSTR],wd2buf[MAXSTR]; static char wd1buf[MAXSTR],wd2buf[MAXSTR];
int first, numch; int first, numch;
@ -112,8 +113,7 @@ char **wrd1,**wrd2; /* no prompt, usually */
} }
int int
yes(x,y,z) /* confirm with rspeak */ yes(int x, int y, int z) /* confirm with rspeak */
int x,y,z;
{ int result; { int result;
int ch; int ch;
@ -137,8 +137,7 @@ int x,y,z;
} }
int int
yesm(x,y,z) /* confirm with mspeak */ yesm(int x, int y, int z) /* confirm with mspeak */
int x,y,z;
{ int result; { int result;
int ch; int ch;
@ -171,7 +170,7 @@ const char iotape[] = "Ax3F'\003tt$8h\315qer*h\017nGKrX\207:!l";
const char *tape = iotape; /* pointer to encryption tape */ const char *tape = iotape; /* pointer to encryption tape */
static int static int
next() /* next virtual char, bump adr */ next(void) /* next virtual char, bump adr */
{ {
int ch; int ch;
@ -187,7 +186,7 @@ next() /* next virtual char, bump adr */
char breakch; /* tell which char ended rnum */ char breakch; /* tell which char ended rnum */
void void
rdata() /* "read" data from virtual file*/ rdata(void) /* "read" data from virtual file*/
{ int sect; { int sect;
char ch; char ch;
@ -258,7 +257,7 @@ char nbf[12];
static int static int
rnum() /* read initial location num */ rnum(void) /* read initial location num */
{ char *s; { char *s;
tape = iotape; /* restart encryption tape */ tape = iotape; /* restart encryption tape */
for (s=nbf,*s=0;; s++) for (s=nbf,*s=0;; s++)
@ -273,8 +272,7 @@ rnum() /* read initial location num */
char *seekhere; char *seekhere;
static void static void
rdesc(sect) /* read description-format msgs */ rdesc(int sect) /* read description-format msgs */
int sect;
{ {
int locc; int locc;
char *seekstart, *maystart; char *seekstart, *maystart;
@ -338,7 +336,7 @@ int sect;
static void static void
rtrav() /* read travel table */ rtrav(void) /* read travel table */
{ int locc; { int locc;
struct travlist *t; struct travlist *t;
char *s; char *s;
@ -397,8 +395,7 @@ rtrav() /* read travel table */
#ifdef DEBUG #ifdef DEBUG
static void static void
twrite(loq) /* travel options from this loc */ twrite(int loq) /* travel options from this loc */
int loq;
{ struct travlist *t; { struct travlist *t;
printf("If"); printf("If");
speak(&ltext[loq]); speak(&ltext[loq]);
@ -418,7 +415,7 @@ int loq;
#endif /* DEBUG */ #endif /* DEBUG */
static void static void
rvoc() rvoc(void)
{ char *s; /* read the vocabulary */ { char *s; /* read the vocabulary */
int rv_index; int rv_index;
char buf[6]; char buf[6];
@ -438,7 +435,7 @@ rvoc()
static void static void
rlocs() /* initial object locations */ rlocs(void) /* initial object locations */
{ for (;;) { for (;;)
{ if ((obj=rnum())<0) break; { if ((obj=rnum())<0) break;
plac[obj]=rnum(); /* initial loc for this obj */ plac[obj]=rnum(); /* initial loc for this obj */
@ -449,7 +446,7 @@ rlocs() /* initial object locations */
} }
static void static void
rdflt() /* default verb messages */ rdflt(void) /* default verb messages */
{ for (;;) { for (;;)
{ if ((verb=rnum())<0) break; { if ((verb=rnum())<0) break;
actspk[verb]=rnum(); actspk[verb]=rnum();
@ -457,7 +454,7 @@ rdflt() /* default verb messages */
} }
static void static void
rliq() /* liquid assets &c: cond bits */ rliq(void) /* liquid assets &c: cond bits */
{ int bitnum; { int bitnum;
for (;;) /* read new bit list */ for (;;) /* read new bit list */
{ if ((bitnum=rnum())<0) break; { if ((bitnum=rnum())<0) break;
@ -469,7 +466,7 @@ rliq() /* liquid assets &c: cond bits */
} }
static void static void
rhints() rhints(void)
{ int hintnum,i; { int hintnum,i;
hntmax=0; hntmax=0;
for (;;) for (;;)
@ -482,22 +479,20 @@ rhints()
void void
rspeak(msg) rspeak(int msg)
int msg;
{ if (msg!=0) speak(&rtext[msg]); { if (msg!=0) speak(&rtext[msg]);
} }
void void
mspeak(msg) mspeak(int msg)
int msg;
{ if (msg!=0) speak(&mtext[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 void
speak(msg) /* read, decrypt, and print a message (not ptext) */ speak(const struct text *msg)
const struct text *msg;/* msg is a pointer to seek address and length of mess */
{ {
char *s, nonfirst; char *s, nonfirst;
@ -519,11 +514,11 @@ const struct text *msg;/* msg is a pointer to seek address and length of mess */
} }
} }
/* read, decrypt an 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 void
pspeak(m,skip) /* read, decrypt an print a ptext message */ pspeak(int m, int skip)
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*/
{ {
char *s,nonfirst; char *s,nonfirst;
char *numst, ps_save; char *numst, ps_save;

View File

@ -121,9 +121,10 @@ struct savestruct save_array[] =
{NULL, 0} {NULL, 0}
}; };
/* Two passes on data: first to get checksum, second */
/* to output the data using checksum to start random #s */
int int
save(outfile) /* Two passes on data: first to get checksum, second */ save(const char *outfile)
const char *outfile; /* to output the data using checksum to start random #s */
{ {
FILE *out; FILE *out;
struct savestruct *p; struct savestruct *p;
@ -156,8 +157,7 @@ const char *outfile; /* to output the data using checksum to start random #s */
} }
int int
restore(infile) restore(const char *infile)
const char *infile;
{ {
FILE *in; FILE *in;
struct savestruct *p; struct savestruct *p;

View File

@ -61,34 +61,30 @@ static int trbridge (void);
/* Statement functions */ /* Statement functions */
int int
toting(objj) toting(int objj)
int objj;
{ if (place[objj] == -1) return(TRUE); { if (place[objj] == -1) return(TRUE);
else return(FALSE); else return(FALSE);
} }
int int
here(objj) here(int objj)
int objj;
{ if (place[objj]==loc || toting(objj)) return(TRUE); { if (place[objj]==loc || toting(objj)) return(TRUE);
else return(FALSE); else return(FALSE);
} }
int int
at(objj) at(int objj)
int objj;
{ if (place[objj]==loc || fixed[objj]==loc) return(TRUE); { if (place[objj]==loc || fixed[objj]==loc) return(TRUE);
else return (FALSE); else return (FALSE);
} }
static int static int
liq2(pbotl) liq2(int pbotl)
int pbotl;
{ return((1-pbotl)*water+(pbotl/2)*(water+oil)); { return((1-pbotl)*water+(pbotl/2)*(water+oil));
} }
int int
liq() liq(void)
{ int i; { int i;
i=prop[bottle]; i=prop[bottle];
if (i>-1-i) return(liq2(i)); if (i>-1-i) return(liq2(i));
@ -96,8 +92,7 @@ liq()
} }
int int
liqloc(locc) /* may want to clean this one up a bit */ liqloc(int locc)
int locc;
{ int i,j,l; { int i,j,l;
i=cond[locc]/2; i=cond[locc]/2;
j=((i*2)%8)-5; j=((i*2)%8)-5;
@ -107,36 +102,33 @@ int locc;
} }
static int static int
bitset(l,n) bitset(int l, int n)
int l,n;
{ if (cond[l] & setbit[n]) return(TRUE); { if (cond[l] & setbit[n]) return(TRUE);
return(FALSE); return(FALSE);
} }
int int
forced(locc) forced(int locc)
int locc;
{ if (cond[locc]==2) return(TRUE); { if (cond[locc]==2) return(TRUE);
return(FALSE); return(FALSE);
} }
int int
dark() dark(void)
{ if ((cond[loc]%2)==0 && (prop[lamp]==0 || !here(lamp))) { if ((cond[loc]%2)==0 && (prop[lamp]==0 || !here(lamp)))
return(TRUE); return(TRUE);
return(FALSE); return(FALSE);
} }
int int
pct(n) pct(int n)
int n;
{ if (ran(100)<n) return(TRUE); { if (ran(100)<n) return(TRUE);
return(FALSE); return(FALSE);
} }
int int
fdwarf() /* 71 */ fdwarf(void) /* 71 */
{ int i,j; { int i,j;
struct travlist *kk; struct travlist *kk;
@ -255,7 +247,7 @@ fdwarf() /* 71 */
int int
march() /* label 8 */ march(void) /* label 8 */
{ int ll1,ll2; { int ll1,ll2;
if ((tkk=travel[newloc=loc])==0) bug(26); if ((tkk=travel[newloc=loc])==0) bug(26);
@ -321,7 +313,7 @@ l12: /* alternative to probability move */
static int static int
mback() /* 20 */ mback(void) /* 20 */
{ struct travlist *tk2,*j; { struct travlist *tk2,*j;
int ll; int ll;
if (forced(k=oldloc)) k=oldlc2; /* k=location */ if (forced(k=oldloc)) k=oldlc2; /* k=location */
@ -356,7 +348,7 @@ mback() /* 20 */
static int static int
specials() /* 30000 */ specials(void) /* 30000 */
{ switch(newloc -= 300) { switch(newloc -= 300)
{ case 1: /* 30100 */ { case 1: /* 30100 */
newloc = 99+100-loc; newloc = 99+100-loc;
@ -377,7 +369,7 @@ specials() /* 30000 */
static int static int
trbridge() /* 30300 */ trbridge(void) /* 30300 */
{ if (prop[troll]==1) { if (prop[troll]==1)
{ pspeak(troll,1); { pspeak(troll,1);
prop[troll]=0; prop[troll]=0;
@ -405,7 +397,7 @@ trbridge() /* 30300 */
static void static void
badmove() /* 20 */ badmove(void) /* 20 */
{ spk=12; { spk=12;
if (k>=43 && k<=50) spk=9; if (k>=43 && k<=50) spk=9;
if (k==29||k==30) spk=9; if (k==29||k==30) spk=9;
@ -418,15 +410,14 @@ badmove() /* 20 */
} }
int int
bug(n) bug(int n)
int n;
{ printf("Please tell jim@rand.org that fatal bug %d happened.\n",n); { printf("Please tell jim@rand.org that fatal bug %d happened.\n",n);
exit(1); exit(1);
} }
void void
checkhints() /* 2600 &c */ checkhints(void) /* 2600 &c */
{ int hint; { int hint;
for (hint=4; hint<=hntmax; hint++) for (hint=4; hint<=hntmax; hint++)
{ if (hinted[hint]) continue; { if (hinted[hint]) continue;
@ -465,7 +456,7 @@ checkhints() /* 2600 &c */
int int
trsay() /* 9030 */ trsay(void) /* 9030 */
{ int i; { int i;
if (*wd2!=0) strcpy(wd1,wd2); if (*wd2!=0) strcpy(wd1,wd2);
i=vocab(wd1,-1,0); i=vocab(wd1,-1,0);
@ -480,7 +471,7 @@ trsay() /* 9030 */
int int
trtake() /* 9010 */ trtake(void) /* 9010 */
{ {
if (toting(obj)) return(2011); /* 9010 */ if (toting(obj)) return(2011); /* 9010 */
spk=25; spk=25;
@ -526,7 +517,7 @@ l9014: if ((obj==bird||obj==cage)&&prop[bird]!=0)
static int static int
dropper() /* 9021 */ dropper(void) /* 9021 */
{ k=liq(); { k=liq();
if (k==obj) obj=bottle; if (k==obj) obj=bottle;
if (obj==bottle&&k!=0) place[k]=0; if (obj==bottle&&k!=0) place[k]=0;
@ -537,7 +528,7 @@ dropper() /* 9021 */
} }
int int
trdrop() /* 9020 */ trdrop(void) /* 9020 */
{ {
if (toting(rod2)&&obj==rod&&!toting(rod)) obj=rod2; if (toting(rod2)&&obj==rod&&!toting(rod)) obj=rod2;
if (!toting(obj)) return(2011); if (!toting(obj)) return(2011);
@ -584,7 +575,7 @@ trdrop() /* 9020 */
int int
tropen() /* 9040 */ tropen(void) /* 9040 */
{ if (obj==clam||obj==oyster) { if (obj==clam||obj==oyster)
{ k=0; /* 9046 */ { k=0; /* 9046 */
if (obj==oyster) k=1; if (obj==oyster) k=1;
@ -640,7 +631,7 @@ tropen() /* 9040 */
int int
trkill() /* 9120 */ trkill(void) /* 9120 */
{ int i; { int i;
for (i=1; i<=5; i++) for (i=1; i<=5; i++)
if (dloc[i]==loc&&dflag>=2) break; if (dloc[i]==loc&&dflag>=2) break;
@ -698,7 +689,7 @@ trkill() /* 9120 */
int int
trtoss() /* 9170: throw */ trtoss(void) /* 9170: throw */
{ int i; { int i;
if (toting(rod2)&&obj==rod&&!toting(rod)) obj=rod2; if (toting(rod2)&&obj==rod&&!toting(rod)) obj=rod2;
if (!toting(obj)) return(2011); if (!toting(obj)) return(2011);
@ -753,7 +744,7 @@ trtoss() /* 9170: throw */
int int
trfeed() /* 9210 */ trfeed(void) /* 9210 */
{ if (obj==bird) { if (obj==bird)
{ spk=100; { spk=100;
return(2011); return(2011);
@ -792,7 +783,7 @@ trfeed() /* 9210 */
int int
trfill() /* 9220 */ trfill(void) /* 9220 */
{ if (obj==vase) { if (obj==vase)
{ spk=29; { spk=29;
if (liqloc(loc)==0) spk=144; if (liqloc(loc)==0) spk=144;
@ -817,7 +808,7 @@ trfill() /* 9220 */
void void
closing() /* 10000 */ closing(void) /* 10000 */
{ int i; { int i;
prop[grate]=prop[fissur]=0; prop[grate]=prop[fissur]=0;
@ -842,7 +833,7 @@ closing() /* 10000 */
void void
caveclose() /* 11000 */ caveclose(void) /* 11000 */
{ int i; { int i;
prop[bottle]=put(bottle,115,1); prop[bottle]=put(bottle,115,1);
prop[plant]=put(plant,115,0); prop[plant]=put(plant,115,0);

View File

@ -53,14 +53,12 @@ static const char rcsid[] =
#include "hdr.h" #include "hdr.h"
void void
dstroy(object) dstroy(int object)
int object;
{ move(object,0); { move(object,0);
} }
void void
juggle(object) juggle(int object)
int object;
{ int i,j; { int i,j;
i=place[object]; i=place[object];
@ -71,8 +69,7 @@ int object;
void void
move(object,where) move(int object, int where)
int object,where;
{ int from; { int from;
if (object<=100) if (object<=100)
@ -85,15 +82,13 @@ int object,where;
int int
put(object,where,pval) put(int object, int where, int pval)
int object,where,pval;
{ move(object,where); { move(object,where);
return(-1-pval); return(-1-pval);
} }
void void
carry(object,where) carry(int object, int where)
int object,where;
{ int temp; { int temp;
if (object<=100) if (object<=100)
@ -111,8 +106,7 @@ int object,where;
void void
drop(object,where) drop(int object, int where)
int object,where;
{ if (object>100) fixed[object-100]=where; { if (object>100) fixed[object-100]=where;
else else
{ if (place[object]== -1) holdng--; { if (place[object]== -1) holdng--;
@ -123,12 +117,11 @@ int object,where;
atloc[where]=object; atloc[where]=object;
} }
/* vocab(): look up or store a word */
/* type: -2 for store, -1 for user word, >=0 for canned lookup*/
/* store: used for storing only */
int int
vocab(word,type,value) /* look up or store a word */ vocab(const char *word, int type, int value)
const char *word;
int type; /* -2 for store, -1 for user word, >=0 for canned lookup*/
int value; /* used for storing only */
{ int adr; { int adr;
const char *s; const char *s;
char *t; char *t;

View File

@ -57,8 +57,7 @@ static const char rcsid[] =
static int wizard (void); static int wizard (void);
void void
datime(d,t) datime(int *d, int *t)
int *d,*t;
{ struct tm *tptr; { struct tm *tptr;
time_t tvec; time_t tvec;
@ -78,14 +77,14 @@ int *d,*t;
char magic[6]; char magic[6];
void void
poof() poof(void)
{ {
strcpy(magic, DECR('d','w','a','r','f')); strcpy(magic, DECR('d','w','a','r','f'));
latncy = 45; latncy = 45;
} }
int int
Start() Start(void)
{ int d,t,delay; { int d,t,delay;
datime(&d,&t); datime(&d,&t);
@ -111,7 +110,7 @@ Start()
} }
static int static int
wizard() /* not as complex as advent/10 (for now) */ wizard(void) /* not as complex as advent/10 (for now) */
{ {
char *word,*x; char *word,*x;
if (!yesm(16,0,7)) return(FALSE); if (!yesm(16,0,7)) return(FALSE);
@ -126,7 +125,7 @@ wizard() /* not as complex as advent/10 (for now) */
} }
void void
ciao() ciao(void)
{ char *c; { char *c;
char fname[80]; char fname[80];
@ -148,8 +147,7 @@ ciao()
int int
ran(range) ran(int range)
int range;
{ {
int i; int i;