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
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=91134
9 changed files with 92 additions and 114 deletions

View File

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

View File

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

View File

@ -171,7 +171,8 @@ u_long crc (const char *ptr, int nr);
void crc_start (void);
int dark (void);
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 done (int entry);
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);
void
init() /* everything for 1st time run */
init(void) /* everything for 1st time run */
{
rdata(); /* read data from orig. file */
linkdata();
poof();
}
char *decr(a,b,c,d,e)
const unsigned char a,b,c,d,e;
char *
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];
@ -82,7 +83,7 @@ const unsigned char a,b,c,d,e;
}
static void
linkdata() /* secondary data manipulation */
linkdata(void) /* secondary data manipulation */
{ int i,j;
/* array linkages */
@ -204,8 +205,7 @@ linkdata() /* secondary data manipulation */
void
trapdel(sig) /* come here if he hits a del */
int sig;
trapdel(int sig) /* come here if he hits a del */
{
sig = 0;
delhit = 1; /* main checks, treats as QUIT */
@ -214,7 +214,7 @@ int sig;
void
startup()
startup(void)
{
demo=Start();
srandomdev();

View File

@ -65,9 +65,10 @@ static void rvoc (void);
static void twrite (int);
#endif
/* 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];
int first, numch;
@ -112,8 +113,7 @@ char **wrd1,**wrd2; /* no prompt, usually */
}
int
yes(x,y,z) /* confirm with rspeak */
int x,y,z;
yes(int x, int y, int z) /* confirm with rspeak */
{ int result;
int ch;
@ -137,8 +137,7 @@ int x,y,z;
}
int
yesm(x,y,z) /* confirm with mspeak */
int x,y,z;
yesm(int x, int y, int z) /* confirm with mspeak */
{ int result;
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 */
static int
next() /* next virtual char, bump adr */
next(void) /* next virtual char, bump adr */
{
int ch;
@ -187,7 +186,7 @@ next() /* next virtual char, bump adr */
char breakch; /* tell which char ended rnum */
void
rdata() /* "read" data from virtual file*/
rdata(void) /* "read" data from virtual file*/
{ int sect;
char ch;
@ -258,7 +257,7 @@ char nbf[12];
static int
rnum() /* read initial location num */
rnum(void) /* read initial location num */
{ char *s;
tape = iotape; /* restart encryption tape */
for (s=nbf,*s=0;; s++)
@ -273,8 +272,7 @@ rnum() /* read initial location num */
char *seekhere;
static void
rdesc(sect) /* read description-format msgs */
int sect;
rdesc(int sect) /* read description-format msgs */
{
int locc;
char *seekstart, *maystart;
@ -338,7 +336,7 @@ int sect;
static void
rtrav() /* read travel table */
rtrav(void) /* read travel table */
{ int locc;
struct travlist *t;
char *s;
@ -397,8 +395,7 @@ rtrav() /* read travel table */
#ifdef DEBUG
static void
twrite(loq) /* travel options from this loc */
int loq;
twrite(int loq) /* travel options from this loc */
{ struct travlist *t;
printf("If");
speak(&ltext[loq]);
@ -418,7 +415,7 @@ int loq;
#endif /* DEBUG */
static void
rvoc()
rvoc(void)
{ char *s; /* read the vocabulary */
int rv_index;
char buf[6];
@ -438,7 +435,7 @@ rvoc()
static void
rlocs() /* initial object locations */
rlocs(void) /* initial object locations */
{ for (;;)
{ if ((obj=rnum())<0) break;
plac[obj]=rnum(); /* initial loc for this obj */
@ -449,7 +446,7 @@ rlocs() /* initial object locations */
}
static void
rdflt() /* default verb messages */
rdflt(void) /* default verb messages */
{ for (;;)
{ if ((verb=rnum())<0) break;
actspk[verb]=rnum();
@ -457,7 +454,7 @@ rdflt() /* default verb messages */
}
static void
rliq() /* liquid assets &c: cond bits */
rliq(void) /* liquid assets &c: cond bits */
{ int bitnum;
for (;;) /* read new bit list */
{ if ((bitnum=rnum())<0) break;
@ -469,7 +466,7 @@ rliq() /* liquid assets &c: cond bits */
}
static void
rhints()
rhints(void)
{ int hintnum,i;
hntmax=0;
for (;;)
@ -482,22 +479,20 @@ rhints()
void
rspeak(msg)
int msg;
rspeak(int msg)
{ if (msg!=0) speak(&rtext[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;
@ -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
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, ps_save;

View File

@ -121,9 +121,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;
@ -156,8 +157,7 @@ const char *outfile; /* to output the data using checksum to start random #s */
}
int
restore(infile)
const char *infile;
restore(const char *infile)
{
FILE *in;
struct savestruct *p;

View File

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

View File

@ -53,14 +53,12 @@ static const char rcsid[] =
#include "hdr.h"
void
dstroy(object)
int object;
dstroy(int object)
{ move(object,0);
}
void
juggle(object)
int object;
juggle(int object)
{ int i,j;
i=place[object];
@ -71,8 +69,7 @@ int object;
void
move(object,where)
int object,where;
move(int object, int where)
{ int from;
if (object<=100)
@ -85,15 +82,13 @@ int 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;
if (object<=100)
@ -111,8 +106,7 @@ int object,where;
void
drop(object,where)
int object,where;
drop(int object, int where)
{ if (object>100) fixed[object-100]=where;
else
{ if (place[object]== -1) holdng--;
@ -123,12 +117,11 @@ int object,where;
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
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;
char *t;

View File

@ -57,8 +57,7 @@ static const char rcsid[] =
static int wizard (void);
void
datime(d,t)
int *d,*t;
datime(int *d, int *t)
{ struct tm *tptr;
time_t tvec;
@ -78,14 +77,14 @@ int *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;
datime(&d,&t);
@ -111,7 +110,7 @@ Start()
}
static int
wizard() /* not as complex as advent/10 (for now) */
wizard(void) /* not as complex as advent/10 (for now) */
{
char *word,*x;
if (!yesm(16,0,7)) return(FALSE);
@ -126,7 +125,7 @@ wizard() /* not as complex as advent/10 (for now) */
}
void
ciao()
ciao(void)
{ char *c;
char fname[80];
@ -148,8 +147,7 @@ ciao()
int
ran(range)
int range;
ran(int range)
{
int i;