diff options
-rw-r--r-- | games/adventure/crc.c | 11 | ||||
-rw-r--r-- | games/adventure/done.c | 13 | ||||
-rw-r--r-- | games/adventure/extern.h | 4 | ||||
-rw-r--r-- | games/adventure/init.c | 16 | ||||
-rw-r--r-- | games/adventure/io.c | 70 | ||||
-rw-r--r-- | games/adventure/main.c | 8 | ||||
-rw-r--r-- | games/adventure/save.c | 14 | ||||
-rw-r--r-- | games/adventure/setup.c | 8 | ||||
-rw-r--r-- | games/adventure/subr.c | 71 | ||||
-rw-r--r-- | games/adventure/vocab.c | 35 | ||||
-rw-r--r-- | games/adventure/wizard.c | 18 | ||||
-rw-r--r-- | games/arithmetic/arithmetic.c | 26 | ||||
-rw-r--r-- | games/banner/banner.c | 8 | ||||
-rw-r--r-- | games/bcd/bcd.c | 11 | ||||
-rw-r--r-- | games/caesar/caesar.c | 13 | ||||
-rw-r--r-- | games/canfield/canfield/canfield.c | 130 | ||||
-rw-r--r-- | games/canfield/cfscores/cfscores.c | 12 | ||||
-rw-r--r-- | games/factor/factor.c | 16 | ||||
-rw-r--r-- | games/fortune/fortune/fortune.c | 111 | ||||
-rw-r--r-- | games/fortune/strfile/strfile.c | 28 | ||||
-rw-r--r-- | games/fortune/unstr/unstr.c | 12 | ||||
-rw-r--r-- | games/primes/primes.c | 18 |
22 files changed, 259 insertions, 394 deletions
diff --git a/games/adventure/crc.c b/games/adventure/crc.c index 475a96559c6..0f5720f5815 100644 --- a/games/adventure/crc.c +++ b/games/adventure/crc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: crc.c,v 1.4 2003/06/03 03:01:37 millert Exp $ */ +/* $OpenBSD: crc.c,v 1.5 2004/07/09 15:59:26 deraadt Exp $ */ /* $NetBSD: crc.c,v 1.2 1995/03/21 12:04:59 cgd Exp $ */ /*- @@ -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 -static char rcsid[] = "$OpenBSD: crc.c,v 1.4 2003/06/03 03:01:37 millert Exp $"; +static char rcsid[] = "$OpenBSD: crc.c,v 1.5 2004/07/09 15:59:26 deraadt Exp $"; #endif #endif /* not lint */ @@ -111,15 +111,14 @@ unsigned long crcval; unsigned int step; void -crc_start() +crc_start(void) { 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; diff --git a/games/adventure/done.c b/games/adventure/done.c index 41e40648ee3..b13d3f99069 100644 --- a/games/adventure/done.c +++ b/games/adventure/done.c @@ -1,4 +1,4 @@ -/* $OpenBSD: done.c,v 1.6 2003/07/10 00:03:01 david Exp $ */ +/* $OpenBSD: done.c,v 1.7 2004/07/09 15:59:26 deraadt Exp $ */ /* $NetBSD: done.c,v 1.2 1995/03/21 12:05:01 cgd Exp $ */ /*- @@ -39,7 +39,7 @@ #if 0 static char sccsid[] = "@(#)done.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$OpenBSD: done.c,v 1.6 2003/07/10 00:03:01 david Exp $"; +static char rcsid[] = "$OpenBSD: done.c,v 1.7 2004/07/09 15:59:26 deraadt Exp $"; #endif #endif /* not lint */ @@ -51,7 +51,7 @@ static char rcsid[] = "$OpenBSD: done.c,v 1.6 2003/07/10 00:03:01 david Exp $"; #include "extern.h" int -score() /* sort of like 20000 */ +score(void) /* sort of like 20000 */ { int scor, i; @@ -104,8 +104,8 @@ score() /* sort of like 20000 */ } void -done(entry) /* entry=1 means goto 13000 */ /* game is over */ - int entry; /* entry=2 means goto 20000 */ /* 3=19000 */ +done(int entry) /* entry=1 means goto 13000 */ /* game is over */ + /* entry=2 means goto 20000 */ /* 3=19000 */ { int i, sc; @@ -139,8 +139,7 @@ done(entry) /* entry=1 means goto 13000 */ /* game is over */ void -die(entry) /* label 90 */ - int entry; +die(int entry) /* label 90 */ { int i; diff --git a/games/adventure/extern.h b/games/adventure/extern.h index a583db00c21..030ac195e4b 100644 --- a/games/adventure/extern.h +++ b/games/adventure/extern.h @@ -1,4 +1,4 @@ -/* $OpenBSD: extern.h,v 1.6 2003/04/07 18:19:37 millert Exp $ */ +/* $OpenBSD: extern.h,v 1.7 2004/07/09 15:59:26 deraadt Exp $ */ /* $NetBSD: extern.h,v 1.3 1997/10/11 01:55:27 lukem Exp $ */ /* @@ -44,7 +44,7 @@ void die(int); /* init.c */ void init(void); -char *decr(int, int, int, int, int); +char *decr(char, char, char, char, char); void linkdata(void); void trapdel(int); void startup(void); diff --git a/games/adventure/init.c b/games/adventure/init.c index 95d3e45b72a..cd249bc050a 100644 --- a/games/adventure/init.c +++ b/games/adventure/init.c @@ -1,4 +1,4 @@ -/* $OpenBSD: init.c,v 1.8 2003/06/03 03:01:37 millert Exp $ */ +/* $OpenBSD: init.c,v 1.9 2004/07/09 15:59:26 deraadt Exp $ */ /* $NetBSD: init.c,v 1.4 1996/05/21 21:53:05 mrg Exp $ */ /*- @@ -39,7 +39,7 @@ #if 0 static char sccsid[] = "@(#)init.c 8.1 (Berkeley) 6/2/93"; #else -static char rcsid[] = "$OpenBSD: init.c,v 1.8 2003/06/03 03:01:37 millert Exp $"; +static char rcsid[] = "$OpenBSD: init.c,v 1.9 2004/07/09 15:59:26 deraadt Exp $"; #endif #endif /* not lint */ @@ -62,7 +62,7 @@ int setbit[16] = {1, 2, 4, 010, 020, 040, 0100, 0200, 0400, 01000, 02000, void -init() /* everything for 1st time run */ +init(void) /* everything for 1st time run */ { rdata(); /* read data from orig. file */ linkdata(); @@ -70,8 +70,7 @@ init() /* everything for 1st time run */ } char * -decr(a, b, c, d, e) - char a, b, c, d, e; +decr(char a, char b, char c, char d, char e) { static char buf[6]; @@ -85,7 +84,7 @@ decr(a, b, c, d, e) } void -linkdata() /* secondary data manipulation */ +linkdata(void) /* secondary data manipulation */ { int i, j; @@ -211,8 +210,7 @@ linkdata() /* secondary data manipulation */ void -trapdel(n) /* come here if he hits a del */ - int n; +trapdel(int n) /* come here if he hits a del */ { delhit = 1; /* main checks, treats as QUIT */ signal(SIGINT, trapdel);/* catch subsequent DELs */ @@ -220,7 +218,7 @@ trapdel(n) /* come here if he hits a del */ void -startup() +startup(void) { demo = Start(); srandomdev(); diff --git a/games/adventure/io.c b/games/adventure/io.c index a67b1b9f65e..d2a03f58e88 100644 --- a/games/adventure/io.c +++ b/games/adventure/io.c @@ -1,4 +1,4 @@ -/* $OpenBSD: io.c,v 1.14 2003/09/25 22:31:43 aaron Exp $ */ +/* $OpenBSD: io.c,v 1.15 2004/07/09 15:59:26 deraadt Exp $ */ /* $NetBSD: io.c,v 1.3 1995/04/24 12:21:37 cgd Exp $ */ /*- @@ -39,7 +39,7 @@ #if 0 static char sccsid[] = "@(#)io.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$OpenBSD: io.c,v 1.14 2003/09/25 22:31:43 aaron Exp $"; +static char rcsid[] = "$OpenBSD: io.c,v 1.15 2004/07/09 15:59:26 deraadt Exp $"; #endif #endif /* not lint */ @@ -52,13 +52,9 @@ static char rcsid[] = "$OpenBSD: io.c,v 1.14 2003/09/25 22:31:43 aaron Exp $"; #include "hdr.h" #include "extern.h" - +/* Get command from user. No prompt, usually. */ void -getin(wrd1, siz1, wrd2, siz2) /* get command from user */ - char *wrd1; /* no prompt, usually */ - size_t siz1; - char *wrd2; - size_t siz2; +getin(char *wrd1, size_t siz1, char *wrd2, size_t siz2) { char *s, *slast; int ch, first; @@ -104,8 +100,7 @@ getin(wrd1, siz1, wrd2, siz2) /* get command from user */ #if 0 /* Not used */ int -confirm(mesg) /* confirm irreversible action */ - char *mesg; +confirm(char *mesg) /* confirm irreversible action */ { int result; int ch; @@ -124,8 +119,7 @@ confirm(mesg) /* confirm irreversible action */ #endif 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; @@ -154,8 +148,7 @@ yes(x, y, z) /* confirm with rspeak */ } 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; @@ -193,7 +186,7 @@ const char iotape[] = "Ax3F'\003tt$8h\315qer*h\017nGKrX\207:!l"; const char *tape = iotape; /* pointer to encryption tape */ int -next() /* next virtual char, bump adr */ +next(void) /* next virtual char, bump adr */ { int ch; @@ -210,7 +203,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; @@ -287,7 +280,7 @@ char nbf[12]; int -rnum() /* read initial location num */ +rnum(void) /* read initial location num */ { char *s; @@ -305,8 +298,7 @@ rnum() /* read initial location num */ char *seekhere; void -rdesc(sect) /* read description-format msgs */ - int sect; +rdesc(int sect) /* read description-format msgs */ { int locc; char *seekstart, *maystart; @@ -369,7 +361,7 @@ rdesc(sect) /* read description-format msgs */ void -rtrav() /* read travel table */ +rtrav(void) /* read travel table */ { int locc; struct travlist *t; @@ -424,8 +416,7 @@ rtrav() /* read travel table */ #ifdef DEBUG void -twrite(loq) /* travel options from this loc */ - int loq; +twrite(int loq) /* travel options from this loc */ { struct travlist *t; @@ -446,7 +437,7 @@ twrite(loq) /* travel options from this loc */ #endif /* DEBUG */ void -rvoc() +rvoc(void) { char *s; /* read the vocabulary */ int index; @@ -472,7 +463,7 @@ rvoc() void -rlocs() /* initial object locations */ +rlocs(void) /* initial object locations */ { for (;;) { if ((obj = rnum()) < 0) @@ -486,7 +477,7 @@ rlocs() /* initial object locations */ } void -rdflt() /* default verb messages */ +rdflt(void) /* default verb messages */ { for (;;) { if ((verb = rnum()) < 0) @@ -496,7 +487,7 @@ rdflt() /* default verb messages */ } void -rliq() /* liquid assets &c: cond bits */ +rliq(void) /* liquid assets &c: cond bits */ { int bitnum; @@ -512,7 +503,7 @@ rliq() /* liquid assets &c: cond bits */ } void -rhints() +rhints(void) { int hintnum, i; @@ -529,8 +520,7 @@ rhints() void -rspeak(msg) - int msg; +rspeak(int msg) { if (msg != 0) speak(&rtext[msg]); @@ -538,18 +528,18 @@ 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; @@ -574,11 +564,13 @@ speak(msg) /* read, decrypt, and print a message (not ptext) */ } } - +/* + * 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, save; diff --git a/games/adventure/main.c b/games/adventure/main.c index 081eb1a98b5..d6f05f20830 100644 --- a/games/adventure/main.c +++ b/games/adventure/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.17 2003/07/10 00:03:01 david Exp $ */ +/* $OpenBSD: main.c,v 1.18 2004/07/09 15:59:26 deraadt Exp $ */ /* $NetBSD: main.c,v 1.5 1996/05/21 21:53:09 mrg Exp $ */ /*- @@ -45,7 +45,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/2/93"; #else -static char rcsid[] = "$OpenBSD: main.c,v 1.17 2003/07/10 00:03:01 david Exp $"; +static char rcsid[] = "$OpenBSD: main.c,v 1.18 2004/07/09 15:59:26 deraadt Exp $"; #endif #endif /* not lint */ @@ -61,9 +61,7 @@ static char rcsid[] = "$OpenBSD: main.c,v 1.17 2003/07/10 00:03:01 david Exp $"; #include "extern.h" int -main(argc, argv) - int argc; - char **argv; +main(int argc, char *argv[]) { int i; int rval, ll; diff --git a/games/adventure/save.c b/games/adventure/save.c index 93827d1a06e..c2b9874a1e8 100644 --- a/games/adventure/save.c +++ b/games/adventure/save.c @@ -1,4 +1,4 @@ -/* $OpenBSD: save.c,v 1.6 2003/06/03 03:01:37 millert Exp $ */ +/* $OpenBSD: save.c,v 1.7 2004/07/09 15:59:26 deraadt Exp $ */ /* $NetBSD: save.c,v 1.2 1995/03/21 12:05:08 cgd Exp $ */ /*- @@ -39,7 +39,7 @@ #if 0 static char sccsid[] = "@(#)save.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$OpenBSD: save.c,v 1.6 2003/06/03 03:01:37 millert Exp $"; +static char rcsid[] = "$OpenBSD: save.c,v 1.7 2004/07/09 15:59:26 deraadt Exp $"; #endif #endif /* not lint */ @@ -119,9 +119,12 @@ 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; @@ -152,8 +155,7 @@ save(outfile) /* Two passes on data: first to get checksum, second */ } int -restore(infile) - const char *infile; +restore(const char *infile) { FILE *in; struct savestruct *p; diff --git a/games/adventure/setup.c b/games/adventure/setup.c index 5b2b5785e82..ee5a86aebd7 100644 --- a/games/adventure/setup.c +++ b/games/adventure/setup.c @@ -1,4 +1,4 @@ -/* $OpenBSD: setup.c,v 1.7 2003/06/03 03:01:37 millert Exp $ */ +/* $OpenBSD: setup.c,v 1.8 2004/07/09 15:59:26 deraadt Exp $ */ /* $NetBSD: setup.c,v 1.2 1995/03/21 12:05:10 cgd Exp $ */ /*- @@ -43,7 +43,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)setup.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$OpenBSD: setup.c,v 1.7 2003/06/03 03:01:37 millert Exp $"; +static char rcsid[] = "$OpenBSD: setup.c,v 1.8 2004/07/09 15:59:26 deraadt Exp $"; #endif #endif /* not lint */ @@ -73,9 +73,7 @@ static char rcsid[] = "$OpenBSD: setup.c,v 1.7 2003/06/03 03:01:37 millert Exp $ #define LINE 10 /* How many values do we get on a line? */ int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { FILE *infile; int c, count, linestart; diff --git a/games/adventure/subr.c b/games/adventure/subr.c index e9891a4ff2f..e27c9505db5 100644 --- a/games/adventure/subr.c +++ b/games/adventure/subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: subr.c,v 1.8 2003/07/10 00:03:01 david Exp $ */ +/* $OpenBSD: subr.c,v 1.9 2004/07/09 15:59:26 deraadt Exp $ */ /* $NetBSD: subr.c,v 1.2 1995/03/21 12:05:11 cgd Exp $ */ /*- @@ -39,7 +39,7 @@ #if 0 static char sccsid[] = "@(#)subr.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$OpenBSD: subr.c,v 1.8 2003/07/10 00:03:01 david Exp $"; +static char rcsid[] = "$OpenBSD: subr.c,v 1.9 2004/07/09 15:59:26 deraadt Exp $"; #endif #endif /* not lint */ @@ -52,8 +52,7 @@ static char rcsid[] = "$OpenBSD: subr.c,v 1.8 2003/07/10 00:03:01 david Exp $"; /* Statement functions */ int -toting(objj) - int objj; +toting(int objj) { if (place[objj] == -1) return (TRUE); @@ -61,8 +60,7 @@ toting(objj) } int -here(objj) - int objj; +here(int objj) { if (place[objj] == loc || toting(objj)) return (TRUE); @@ -70,8 +68,7 @@ here(objj) } int -at(objj) - int objj; +at(int objj) { if (place[objj] == loc || fixed[objj] == loc) return (TRUE); @@ -80,14 +77,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; @@ -98,8 +94,7 @@ liq() } int -liqloc(locc) /* may want to clean this one up a bit */ - int locc; +liqloc(int locc) /* may want to clean this one up a bit */ { int i, j, l; @@ -111,8 +106,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); @@ -120,8 +114,7 @@ bitset(l, n) } int -forced(locc) - int locc; +forced(int locc) { if (cond[locc] == 2) return (TRUE); @@ -129,7 +122,7 @@ forced(locc) } int -dark() +dark(void) { if ((cond[loc] % 2) == 0 && (prop[lamp] == 0 || !here(lamp))) return (TRUE); @@ -137,8 +130,7 @@ dark() } int -pct(n) - int n; +pct(int n) { if (ran(100) < n) return (TRUE); @@ -147,7 +139,7 @@ pct(n) int -fdwarf() /* 71 */ +fdwarf(void) /* 71 */ { int i, j; struct travlist *kk; @@ -294,7 +286,7 @@ l82: if (stick <= 1) { /* 82 */ int -march() /* label 8 */ +march(void) /* label 8 */ { int ll1, ll2; @@ -372,7 +364,7 @@ l12: /* alternative to probability move */ int -mback() /* 20 */ +mback(void) /* 20 */ { struct travlist *tk2,*j; int ll; @@ -411,7 +403,7 @@ mback() /* 20 */ int -specials() /* 30000 */ +specials(void) /* 30000 */ { switch(newloc -= 300) { case 1: /* 30100 */ @@ -433,7 +425,7 @@ specials() /* 30000 */ int -trbridge() /* 30300 */ +trbridge(void) /* 30300 */ { if (prop[troll] == 1) { pspeak(troll, 1); @@ -465,7 +457,7 @@ trbridge() /* 30300 */ void -badmove() /* 20 */ +badmove(void) /* 20 */ { spk = 12; if (k >= 43 && k <= 50) @@ -486,8 +478,7 @@ badmove() /* 20 */ } void -bug(n) - int n; +bug(int n) { /* printf("Please tell jim@rand.org that fatal bug %d happened.\n",n); */ fprintf(stderr, @@ -497,7 +488,7 @@ bug(n) void -checkhints() /* 2600 &c */ +checkhints(void) /* 2600 &c */ { int hint; @@ -548,7 +539,7 @@ l40020: hintlc[hint] = 0; int -trsay() /* 9030 */ +trsay(void) /* 9030 */ { int i; @@ -566,7 +557,7 @@ trsay() /* 9030 */ int -trtake() /* 9010 */ +trtake(void) /* 9010 */ { if (toting(obj)) return (2011); /* 9010 */ @@ -621,7 +612,7 @@ l9014: if ((obj == bird || obj == cage) && prop[bird] != 0) int -dropper() /* 9021 */ +dropper(void) /* 9021 */ { k = liq(); if (k == obj) @@ -637,7 +628,7 @@ dropper() /* 9021 */ } int -trdrop() /* 9020 */ +trdrop(void) /* 9020 */ { if (toting(rod2) && obj == rod && !toting(rod)) obj = rod2; @@ -690,7 +681,7 @@ trdrop() /* 9020 */ int -tropen() /* 9040 */ +tropen(void) /* 9040 */ { if (obj == clam || obj == oyster) { k = 0; /* 9046 */ @@ -768,7 +759,7 @@ tropen() /* 9040 */ int -trkill() /* 9120 */ +trkill(void) /* 9120 */ { int i; @@ -851,7 +842,7 @@ trkill() /* 9120 */ int -trtoss() /* 9170: throw */ +trtoss(void) /* 9170: throw */ { int i; @@ -914,7 +905,7 @@ l9175: int -trfeed() /* 9210 */ +trfeed(void) /* 9210 */ { if (obj == bird) { spk = 100; @@ -961,7 +952,7 @@ trfeed() /* 9210 */ int -trfill() /* 9220 */ +trfill(void) /* 9220 */ { if (obj == vase) { spk = 29; @@ -996,7 +987,7 @@ trfill() /* 9220 */ void -closing() /* 10000 */ +closing(void) /* 10000 */ { int i; @@ -1023,7 +1014,7 @@ closing() /* 10000 */ void -caveclose() /* 11000 */ +caveclose(void) /* 11000 */ { int i; diff --git a/games/adventure/vocab.c b/games/adventure/vocab.c index cddb76cd381..688a1f5b1c8 100644 --- a/games/adventure/vocab.c +++ b/games/adventure/vocab.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vocab.c,v 1.10 2003/06/03 03:01:37 millert Exp $ */ +/* $OpenBSD: vocab.c,v 1.11 2004/07/09 15:59:26 deraadt Exp $ */ /* $NetBSD: vocab.c,v 1.2 1995/03/21 12:05:13 cgd Exp $ */ /*- @@ -39,7 +39,7 @@ #if 0 static char sccsid[] = "@(#)vocab.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$OpenBSD: vocab.c,v 1.10 2003/06/03 03:01:37 millert Exp $"; +static char rcsid[] = "$OpenBSD: vocab.c,v 1.11 2004/07/09 15:59:26 deraadt Exp $"; #endif #endif /* not lint */ @@ -52,15 +52,13 @@ static char rcsid[] = "$OpenBSD: vocab.c,v 1.10 2003/06/03 03:01:37 millert 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; @@ -72,8 +70,7 @@ juggle(object) void -move(object, where) - int object, where; +move(int object, int where) { int from; @@ -88,8 +85,7 @@ 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); @@ -97,8 +93,7 @@ put(object, where, pval) void -carry(object, where) - int object, where; +carry(int object, int where) { int temp; @@ -119,8 +114,7 @@ carry(object, where) void -drop(object, where) - int object, where; +drop(int object, int where) { if (object > 100) fixed[object - 100] = where; @@ -135,12 +129,13 @@ drop(object, where) atloc[where] = object; } - +/* + * Look up or store a word + * type: -2 for store, -1 for user word, >=0 for canned lookup + * value: 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; @@ -200,7 +195,7 @@ exitloop2: /* hashed entry does not match */ } void -prht() /* print hash table */ +prht(void) /* print hash table */ { int i, j, l; char *c; diff --git a/games/adventure/wizard.c b/games/adventure/wizard.c index 68d5c020cdb..2fa65cbeb02 100644 --- a/games/adventure/wizard.c +++ b/games/adventure/wizard.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wizard.c,v 1.12 2003/06/03 03:01:37 millert Exp $ */ +/* $OpenBSD: wizard.c,v 1.13 2004/07/09 15:59:26 deraadt Exp $ */ /* $NetBSD: wizard.c,v 1.3 1995/04/24 12:21:41 cgd Exp $ */ /*- @@ -39,7 +39,7 @@ #if 0 static char sccsid[] = "@(#)wizard.c 8.1 (Berkeley) 6/2/93"; #else -static char rcsid[] = "$OpenBSD: wizard.c,v 1.12 2003/06/03 03:01:37 millert Exp $"; +static char rcsid[] = "$OpenBSD: wizard.c,v 1.13 2004/07/09 15:59:26 deraadt Exp $"; #endif #endif /* not lint */ @@ -55,8 +55,7 @@ static char rcsid[] = "$OpenBSD: wizard.c,v 1.12 2003/06/03 03:01:37 millert Exp #if 0 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) { strlcpy(magic, DECR(d,w,a,r,f), sizeof magic); latncy = 45; } int -Start() +Start(void) { time_t t, delay; @@ -107,7 +106,7 @@ Start() } int -wizard() /* not as complex as advent/10 (for now) */ +wizard(void) /* not as complex as advent/10 (for now) */ { if (!yesm(16, 0, 7)) return (FALSE); @@ -122,7 +121,7 @@ wizard() /* not as complex as advent/10 (for now) */ } void -ciao() +ciao(void) { int ch; char *c; @@ -148,8 +147,7 @@ ciao() int -ran(range) - int range; +ran(int range) { long i; diff --git a/games/arithmetic/arithmetic.c b/games/arithmetic/arithmetic.c index d352d6cb5e9..367cee763b1 100644 --- a/games/arithmetic/arithmetic.c +++ b/games/arithmetic/arithmetic.c @@ -1,4 +1,4 @@ -/* $OpenBSD: arithmetic.c,v 1.14 2003/06/03 03:01:37 millert Exp $ */ +/* $OpenBSD: arithmetic.c,v 1.15 2004/07/09 15:59:26 deraadt Exp $ */ /* * Copyright (c) 1989, 1993 @@ -42,7 +42,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)arithmetic.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$OpenBSD: arithmetic.c,v 1.14 2003/06/03 03:01:37 millert Exp $"; +static char rcsid[] = "$OpenBSD: arithmetic.c,v 1.15 2004/07/09 15:59:26 deraadt Exp $"; #endif #endif /* not lint */ @@ -109,9 +109,7 @@ time_t qtime; * so far are printed. */ int -main(argc, argv) - int argc; - char **argv; +main(int argc, char *argv[]) { extern char *optarg; extern int optind; @@ -157,8 +155,7 @@ main(argc, argv) /* Handle interrupt character. Print score and exit. */ void -intr(dummy) - int dummy; +intr(int dummy) { showstats(); exit(0); @@ -166,7 +163,7 @@ intr(dummy) /* Print score. Original `arithmetic' had a delay after printing it. */ void -showstats() +showstats(void) { if (nright + nwrong > 0) { (void)printf("\n\nRights %d; Wrongs %d; Score %d%%", @@ -187,7 +184,7 @@ showstats() * more likely to appear in subsequent problems. */ int -problem() +problem(void) { char *p; time_t start, finish; @@ -299,8 +296,7 @@ struct penalty { * forget about the penalty (how likely is this, anyway?). */ void -penalise(value, op, operand) - int value, op, operand; +penalise(int value, int op, int operand) { struct penalty *p; @@ -320,8 +316,7 @@ penalise(value, op, operand) * we find the corresponding value and return that, decreasing its penalty. */ int -getrandom(maxval, op, operand) - int maxval, op, operand; +getrandom(int maxval, int op, int operand) { int value; struct penalty **pp, *p; @@ -365,8 +360,7 @@ getrandom(maxval, op, operand) /* Return an index for the character op, which is one of [+-x/]. */ int -opnum(op) - int op; +opnum(int op) { char *p; @@ -377,7 +371,7 @@ opnum(op) /* Print usage message and quit. */ void -usage() +usage(void) { (void)fprintf(stderr, "usage: arithmetic [-o +-x/] [-r range]\n"); exit(1); diff --git a/games/banner/banner.c b/games/banner/banner.c index 122ba60a022..d2a0b39c159 100644 --- a/games/banner/banner.c +++ b/games/banner/banner.c @@ -1,4 +1,4 @@ -/* $OpenBSD: banner.c,v 1.11 2003/10/01 05:59:37 cloder Exp $ */ +/* $OpenBSD: banner.c,v 1.12 2004/07/09 15:59:26 deraadt Exp $ */ /* $NetBSD: banner.c,v 1.4 1995/04/22 11:55:15 cgd Exp $ */ /* @@ -40,7 +40,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)banner.c 8.3 (Berkeley) 4/2/94"; #else -static char rcsid[] = "$OpenBSD: banner.c,v 1.11 2003/10/01 05:59:37 cloder Exp $"; +static char rcsid[] = "$OpenBSD: banner.c,v 1.12 2004/07/09 15:59:26 deraadt Exp $"; #endif #endif /* not lint */ @@ -1027,9 +1027,7 @@ int debug, i, j, linen, max, nchars, pc, term, trace, x, y; int width = DWIDTH; /* -w option: scrunch letters to 80 columns */ int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { int ch; diff --git a/games/bcd/bcd.c b/games/bcd/bcd.c index 05da17e09a1..063ddd940d7 100644 --- a/games/bcd/bcd.c +++ b/games/bcd/bcd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bcd.c,v 1.10 2003/07/10 00:03:01 david Exp $ */ +/* $OpenBSD: bcd.c,v 1.11 2004/07/09 15:59:26 deraadt Exp $ */ /* $NetBSD: bcd.c,v 1.6 1995/04/24 12:22:23 cgd Exp $ */ /* @@ -43,7 +43,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)bcd.c 8.2 (Berkeley) 3/20/94"; #else -static char rcsid[] = "$OpenBSD: bcd.c,v 1.10 2003/07/10 00:03:01 david Exp $"; +static char rcsid[] = "$OpenBSD: bcd.c,v 1.11 2004/07/09 15:59:26 deraadt Exp $"; #endif #endif /* not lint */ @@ -127,9 +127,7 @@ u_short holes[256] = { void printcard(char *); int -main(argc, argv) - int argc; - char **argv; +main(int argc, char *argv[]) { char cardline[80]; @@ -150,8 +148,7 @@ main(argc, argv) #define COLUMNS 48 void -printcard(str) - char *str; +printcard(char *str) { static const char rowchars[] = " 123456789"; int i, row; diff --git a/games/caesar/caesar.c b/games/caesar/caesar.c index 579f8dbe3d4..6854dc2a06a 100644 --- a/games/caesar/caesar.c +++ b/games/caesar/caesar.c @@ -1,4 +1,4 @@ -/* $OpenBSD: caesar.c,v 1.12 2003/06/03 03:01:39 millert Exp $ */ +/* $OpenBSD: caesar.c,v 1.13 2004/07/09 15:59:26 deraadt Exp $ */ /* * Copyright (c) 1989, 1993 @@ -47,7 +47,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)caesar.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$OpenBSD: caesar.c,v 1.12 2003/06/03 03:01:39 millert Exp $"; +static char rcsid[] = "$OpenBSD: caesar.c,v 1.13 2004/07/09 15:59:26 deraadt Exp $"; #endif #endif /* not lint */ @@ -80,9 +80,7 @@ void usage(void); int -main(argc, argv) - int argc; - char **argv; +main(int argc, char *argv[]) { int ch, dot, i, nread, winnerdot; char *inbuf, *p, **av; @@ -148,8 +146,7 @@ main(argc, argv) } void -printit(rot) - int rot; +printit(int rot) { int ch; @@ -162,7 +159,7 @@ printit(rot) } void -usage() +usage(void) { fprintf(stderr,"usage: caesar [rotation]\n"); exit(1); diff --git a/games/canfield/canfield/canfield.c b/games/canfield/canfield/canfield.c index 978dfb04665..60c8ce2fcfc 100644 --- a/games/canfield/canfield/canfield.c +++ b/games/canfield/canfield/canfield.c @@ -1,4 +1,4 @@ -/* $OpenBSD: canfield.c,v 1.9 2003/06/03 03:01:39 millert Exp $ */ +/* $OpenBSD: canfield.c,v 1.10 2004/07/09 15:59:26 deraadt Exp $ */ /* $NetBSD: canfield.c,v 1.7 1995/05/13 07:28:35 jtc Exp $ */ /* @@ -40,7 +40,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)canfield.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$OpenBSD: canfield.c,v 1.9 2003/06/03 03:01:39 millert Exp $"; +static char rcsid[] = "$OpenBSD: canfield.c,v 1.10 2004/07/09 15:59:26 deraadt Exp $"; #endif #endif /* not lint */ @@ -254,7 +254,7 @@ void usedtalon(void); * procedure to set the move command box */ void -movebox() +movebox(void) { switch (status) { case BETTINGBOX: @@ -289,7 +289,7 @@ movebox() * print directions above move box */ void -printtopinstructions() +printtopinstructions(void) { move(tboxrow, boxcol); printw("*----------------------------------*"); @@ -323,7 +323,7 @@ printtopinstructions() * Print the betting box. */ void -printtopbettingbox() +printtopbettingbox(void) { move(tboxrow, boxcol); @@ -358,7 +358,7 @@ printtopbettingbox() * clear info above move box */ void -clearabovemovebox() +clearabovemovebox(void) { int i; @@ -374,7 +374,7 @@ clearabovemovebox() * print instructions below move box */ void -printbottominstructions() +printbottominstructions(void) { move(bboxrow, boxcol); printw("|Replace # with the number of the |"); @@ -388,7 +388,7 @@ printbottominstructions() * print betting information below move box */ void -printbottombettingbox() +printbottombettingbox(void) { move(bboxrow, boxcol); printw("|x = toggle information box |"); @@ -402,7 +402,7 @@ printbottombettingbox() * clear info below move box */ void -clearbelowmovebox() +clearbelowmovebox(void) { int i; @@ -418,7 +418,7 @@ clearbelowmovebox() * procedure to put the board on the screen using addressable cursor */ void -makeboard() +makeboard(void) { clear(); refresh(); @@ -457,7 +457,7 @@ makeboard() * clean up the board for another game */ void -cleanupboard() +cleanupboard(void) { int cnt, row, col; struct cardtype *ptr; @@ -513,8 +513,7 @@ cleanupboard() * procedure to create a deck of cards */ void -initdeck(deck) - struct cardtype *deck[]; +initdeck(struct cardtype *deck[]) { int i; int scnt; @@ -539,8 +538,7 @@ initdeck(deck) * procedure to shuffle the deck */ void -shuffle(deck) - struct cardtype *deck[]; +shuffle(struct cardtype *deck[]) { int i,j; struct cardtype *temp; @@ -563,8 +561,7 @@ shuffle(deck) * procedure to remove the card from the board */ void -removecard(a, b) - int a, b; +removecard(int a, int b) { move(b, a); printw(" "); @@ -574,10 +571,7 @@ removecard(a, b) * procedure to print the cards on the board */ void -printrank(a, b, cp, inverse) - int a, b; - const struct cardtype *cp; - bool inverse; +printrank(int a, int b, const struct cardtype *cp, bool inverse) { move(b, a); if (cp->rank != 10) @@ -609,9 +603,7 @@ printrank(a, b, cp, inverse) * procedure to print out a card */ void -printcard(a, b, cp) - int a, b; - const struct cardtype *cp; +printcard(int a, int b, const struct cardtype *cp) { if (cp == NIL) removecard(a, b); @@ -636,8 +628,7 @@ printcard(a, b, cp) * of the piles. */ void -transit(source, dest) - struct cardtype **source, **dest; +transit(struct cardtype **source, struct cardtype **dest) { struct cardtype *temp; @@ -653,9 +644,7 @@ transit(source, dest) * the game, so the pile will have exactly one card in it. */ void -fndbase(cp, column, row) - struct cardtype **cp; - int column, row; +fndbase(struct cardtype **cp, int column, int row) { bool nomore; @@ -699,7 +688,7 @@ fndbase(cp, column, row) * procedure to initialize the things necessary for the game */ void -initgame() +initgame(void) { int i; @@ -745,7 +734,7 @@ initgame() * procedure to print the beginning cards and to start each game */ void -startgame() +startgame(void) { int j; @@ -786,7 +775,7 @@ startgame() * procedure to clear the message printed from an error */ void -clearmsg() +clearmsg(void) { int i; @@ -803,7 +792,7 @@ clearmsg() * procedure to print an error message if the move is not listed */ void -dumberror() +dumberror(void) { errmsg = TRUE; move(msgrow, msgcol); @@ -814,7 +803,7 @@ dumberror() * procedure to print an error message if the move is not possible */ void -destinerror() +destinerror(void) { errmsg = TRUE; move(msgrow, msgcol); @@ -825,8 +814,7 @@ destinerror() * function to see if the source has cards in it */ bool -notempty(cp) - const struct cardtype *cp; +notempty(const struct cardtype *cp) { if (cp == NIL) { errmsg = TRUE; @@ -841,8 +829,7 @@ notempty(cp) * function to see if the rank of one card is less than another */ bool -ranklower(cp1, cp2) - const struct cardtype *cp1, *cp2; +ranklower(const struct cardtype *cp1, const struct cardtype *cp2) { if (cp2->rank == Ace) if (cp1->rank == King) @@ -859,8 +846,7 @@ ranklower(cp1, cp2) * function to check the cardcolor for moving to a tableau */ bool -diffcolor(cp1, cp2) - const struct cardtype *cp1, *cp2; +diffcolor(const struct cardtype *cp1, const struct cardtype *cp2) { if (cp1->color == cp2->color) return (FALSE); @@ -872,9 +858,7 @@ diffcolor(cp1, cp2) * function to see if the card can move to the tableau */ bool -tabok(cp, des) - const struct cardtype *cp; - int des; +tabok(const struct cardtype *cp, int des) { if ((cp == stock) && (tableau[des] == NIL)) return (TRUE); @@ -895,7 +879,7 @@ tabok(cp, des) * procedure to turn the cards onto the talon from the deck */ void -movetotalon() +movetotalon(void) { int i, fin; @@ -980,7 +964,7 @@ movetotalon() * procedure to print card counting info on screen */ void -showstat() +showstat(void) { int row, col; struct cardtype *ptr; @@ -1023,7 +1007,7 @@ showstat() * procedure to clear card counting info from screen */ void -clearstat() +clearstat(void) { int row; @@ -1043,7 +1027,7 @@ clearstat() * procedure to update card counting base */ void -usedtalon() +usedtalon(void) { removecard(coldcol, coldrow); DECRHAND(coldrow, coldcol); @@ -1068,7 +1052,7 @@ usedtalon() * procedure to update stock card counting base */ void -usedstock() +usedstock(void) { stockcnt--; if (Cflag) { @@ -1081,7 +1065,7 @@ usedstock() * let 'em know how they lost! */ void -showcards() +showcards(void) { struct cardtype *ptr; int row; @@ -1129,7 +1113,7 @@ showcards() * procedure to update the betting values */ void -updatebettinginfo() +updatebettinginfo(void) { long thiscosts, gamecosts, totalcosts; double thisreturn, gamereturn, totalreturn; @@ -1188,9 +1172,7 @@ updatebettinginfo() * procedure to move a card from the stock or talon to the tableau */ void -simpletableau(cp, des) - struct cardtype **cp; - int des; +simpletableau(struct cardtype **cp, int des) { int origin; @@ -1222,8 +1204,7 @@ simpletableau(cp, des) * print the tableau */ void -tabprint(sour, des) - int sour, des; +tabprint(int sour, int des) { int dlength, slength, i; struct cardtype *tempcard; @@ -1249,8 +1230,7 @@ tabprint(sour, des) * procedure to move from the tableau to the tableau */ void -tabtotab(sour, des) - int sour, des; +tabtotab(int sour, int des) { struct cardtype *temp; @@ -1276,9 +1256,7 @@ tabtotab(sour, des) * functions to see if the card can go onto the foundation */ bool -rankhigher(cp, let) - const struct cardtype *cp; - int let; +rankhigher(const struct cardtype *cp, int let) { if (found[let]->rank == King) if (cp->rank == Ace) @@ -1295,9 +1273,7 @@ rankhigher(cp, let) * function to determine if two cards are the same suit */ int -samesuit(cp, let) - const struct cardtype *cp; - int let; +samesuit(const struct cardtype *cp, int let) { if (cp->suit == found[let]->suit) return (TRUE); @@ -1309,9 +1285,7 @@ samesuit(cp, let) * procedure to move a card to the correct foundation pile */ void -movetofound(cp, source) - struct cardtype **cp; - int source; +movetofound(struct cardtype **cp, int source) { tempbase = 0; mtfdone = FALSE; @@ -1361,9 +1335,7 @@ movetofound(cp, source) * procedure to get a command */ void -getcmd(row, col, cp) - int row, col; - const char *cp; +getcmd(int row, int col, const char *cp) { char cmd[2] = { '\0', '\0'}; int ch, i; @@ -1414,7 +1386,7 @@ getcmd(row, col, cp) * Suspend the game (shell escape if no process control on system) */ void -suspend() +suspend(void) { #ifndef SIGTSTP char *sh; @@ -1436,7 +1408,7 @@ suspend() * procedure to evaluate and make the specific moves */ void -movecard() +movecard(void) { int source, dest; char osrcpile, odestpile; @@ -1632,7 +1604,7 @@ const char *const bettinginstructions[] = { * procedure to printout instructions */ void -instruct() +instruct(void) { const char *const *cp; @@ -1668,7 +1640,7 @@ instruct() * procedure to initialize the game */ void -initall() +initall(void) { int i; @@ -1700,7 +1672,7 @@ initall() * procedure to end the game */ bool -finish() +finish(void) { int row, col; @@ -1738,8 +1710,7 @@ finish() * procedure to clean up and exit */ void -cleanup(dummy) - int dummy; +cleanup(int dummy) { total.thinktime += 1; @@ -1762,8 +1733,7 @@ cleanup(dummy) * Field an interrupt. */ void -askquit(dummy) - int dummy; +askquit(int dummy) { move(msgrow, msgcol); printw("Really wish to quit? "); @@ -1780,9 +1750,7 @@ askquit(dummy) * Can you tell that this used to be a Pascal program? */ int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { #ifdef MAXLOAD double vec[3]; diff --git a/games/canfield/cfscores/cfscores.c b/games/canfield/cfscores/cfscores.c index 2fd2559ce5b..177f5c2caa2 100644 --- a/games/canfield/cfscores/cfscores.c +++ b/games/canfield/cfscores/cfscores.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cfscores.c,v 1.11 2003/07/10 00:03:01 david Exp $ */ +/* $OpenBSD: cfscores.c,v 1.12 2004/07/09 15:59:26 deraadt Exp $ */ /* $NetBSD: cfscores.c,v 1.3 1995/03/21 15:08:37 cgd Exp $ */ /* @@ -40,7 +40,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)cfscores.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$OpenBSD: cfscores.c,v 1.11 2003/07/10 00:03:01 david Exp $"; +static char rcsid[] = "$OpenBSD: cfscores.c,v 1.12 2004/07/09 15:59:26 deraadt Exp $"; #endif #endif /* not lint */ @@ -70,9 +70,7 @@ int dbfd; void printuser(const struct passwd *, int); int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { struct passwd *pw; int uid; @@ -118,9 +116,7 @@ main(argc, argv) * print out info for specified password entry */ void -printuser(pw, printfail) - const struct passwd *pw; - int printfail; +printuser(const struct passwd *pw, int printfail) { struct betinfo total; int i; diff --git a/games/factor/factor.c b/games/factor/factor.c index df52836a6b7..b9a8340330c 100644 --- a/games/factor/factor.c +++ b/games/factor/factor.c @@ -1,4 +1,4 @@ -/* $OpenBSD: factor.c,v 1.14 2003/06/03 03:01:39 millert Exp $ */ +/* $OpenBSD: factor.c,v 1.15 2004/07/09 15:59:26 deraadt Exp $ */ /* $NetBSD: factor.c,v 1.5 1995/03/23 08:28:07 cgd Exp $ */ /* @@ -43,7 +43,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)factor.c 8.4 (Berkeley) 5/4/95"; #else -static char rcsid[] = "$OpenBSD: factor.c,v 1.14 2003/06/03 03:01:39 millert Exp $"; +static char rcsid[] = "$OpenBSD: factor.c,v 1.15 2004/07/09 15:59:26 deraadt Exp $"; #endif #endif /* not lint */ @@ -95,9 +95,7 @@ void pr_bigfact(u_int64_t); void usage(void); int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { u_int64_t val; int ch; @@ -166,8 +164,7 @@ main(argc, argv) * Factors are printed with leading tabs. */ void -pr_fact(val) - u_int64_t val; /* Factor this value. */ +pr_fact(u_int64_t val) /* Factor this value. */ { const ubig *fact; /* The factor found. */ @@ -216,8 +213,7 @@ pr_fact(val) * sufficient to factor a 64-bit quad. */ void -pr_bigfact(val) - u_int64_t val; /* Factor this value. */ +pr_bigfact(u_int64_t val) /* Factor this value. */ { ubig start, stop, factor; char *q; @@ -299,7 +295,7 @@ pr_bigfact(val) void -usage() +usage(void) { (void)fprintf(stderr, "usage: factor [value ...]\n"); exit (0); diff --git a/games/fortune/fortune/fortune.c b/games/fortune/fortune/fortune.c index 24b331d43c9..9bf2694da91 100644 --- a/games/fortune/fortune/fortune.c +++ b/games/fortune/fortune/fortune.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fortune.c,v 1.19 2003/06/18 23:37:36 pvalchev Exp $ */ +/* $OpenBSD: fortune.c,v 1.20 2004/07/09 15:59:26 deraadt Exp $ */ /* $NetBSD: fortune.c,v 1.8 1995/03/23 08:28:40 cgd Exp $ */ /*- @@ -43,7 +43,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)fortune.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$OpenBSD: fortune.c,v 1.19 2003/06/18 23:37:36 pvalchev Exp $"; +static char rcsid[] = "$OpenBSD: fortune.c,v 1.20 2004/07/09 15:59:26 deraadt Exp $"; #endif #endif /* not lint */ @@ -181,9 +181,7 @@ char *regcmp(), *regex(); #endif int -main(ac, av) - int ac; - char *av[]; +main(int ac, char *av[]) { #ifdef OK_TO_WRITE_DISK int fd; @@ -236,8 +234,7 @@ main(ac, av) } void -display(fp) - FILEDESC *fp; +display(FILEDESC *fp) { char *p, ch; char line[BUFSIZ]; @@ -262,7 +259,7 @@ display(fp) * Return the length of the fortune. */ int -fortlen() +fortlen(void) { int nchar; char line[BUFSIZ]; @@ -285,9 +282,7 @@ fortlen() * This routine evaluates the arguments on the command line */ void -getargs(argc, argv) - int argc; - char **argv; +getargs(int argc, char *argv[]) { int ignore_case; # ifndef NO_REGEX @@ -386,9 +381,7 @@ getargs(argc, argv) * Form the file list from the file specifications. */ int -form_file_list(files, file_cnt) - char **files; - int file_cnt; +form_file_list(char **files, int file_cnt) { int i, percent; char *sp; @@ -446,12 +439,8 @@ form_file_list(files, file_cnt) * Add a file to the file list. */ int -add_file(percent, file, dir, head, tail, parent) - int percent; - char *file; - char *dir; - FILEDESC **head, **tail; - FILEDESC *parent; +add_file(int percent, char *file, char *dir, FILEDESC **head, FILEDESC **tail, + FILEDESC *parent) { FILEDESC *fp; int fd; @@ -576,7 +565,7 @@ over: * Return a pointer to an initialized new FILEDESC. */ FILEDESC * -new_fp() +new_fp(void) { FILEDESC *fp; @@ -601,8 +590,7 @@ new_fp() * Return a pointer to the offensive version of a file of this name. */ char * -off_name(file) - char *file; +off_name(char *file) { return (copy(file, "-o")); } @@ -612,8 +600,7 @@ off_name(file) * Is the file an offensive-style name? */ int -is_off_name(file) - char *file; +is_off_name(char *file) { int len; @@ -627,9 +614,7 @@ is_off_name(file) * there are two children to be a parent of. */ void -all_forts(fp, offensive) - FILEDESC *fp; - char *offensive; +all_forts(FILEDESC *fp, char *offensive) { char *sp; FILEDESC *scene, *obscene; @@ -677,8 +662,7 @@ all_forts(fp, offensive) * Add the contents of an entire directory. */ int -add_dir(fp) - FILEDESC *fp; +add_dir(FILEDESC *fp) { DIR *dir; struct dirent *dirent; @@ -716,8 +700,7 @@ add_dir(fp) * Return TRUE if the file is a directory, FALSE otherwise. */ int -is_dir(file) - char *file; +is_dir(char *file) { struct stat sbuf; @@ -735,9 +718,7 @@ is_dir(file) */ /* ARGSUSED */ int -is_fortfile(file, datp, posp, check_for_offend) - char *file, **datp, **posp; - int check_for_offend; +is_fortfile(char *file, char **datp, char **posp, int check_for_offend) { int i; char *sp; @@ -801,9 +782,7 @@ is_fortfile(file, datp, posp, check_for_offend) * Return a malloc()'ed copy of the string + an optional suffix */ char * -copy(str, suf) - char *str; - char *suf; +copy(char *str, char *suf) { char *new; @@ -817,8 +796,7 @@ copy(str, suf) * Do a malloc, checking for NULL return. */ void * -do_malloc(size) - unsigned int size; +do_malloc(unsigned int size) { void *new; @@ -834,8 +812,7 @@ do_malloc(size) * Free malloc'ed space, if any. */ void -do_free(ptr) - void *ptr; +do_free(void *ptr) { if (ptr != NULL) free(ptr); @@ -846,7 +823,7 @@ do_free(ptr) * Initialize the fortune probabilities. */ void -init_prob() +init_prob(void) { FILEDESC *fp, *last; int percent, num_noprob, frac; @@ -918,7 +895,7 @@ init_prob() * Get the fortune data file's seek pointer for the next fortune. */ void -get_fort() +get_fort(void) { FILEDESC *fp; int choice; @@ -982,8 +959,7 @@ get_fort() * Pick a child from a chosen parent. */ FILEDESC * -pick_child(parent) - FILEDESC *parent; +pick_child(FILEDESC *parent) { FILEDESC *fp; int choice; @@ -1019,8 +995,7 @@ pick_child(parent) * Sum up all the noprob probabilities, starting with fp. */ void -sum_noprobs(fp) - FILEDESC *fp; +sum_noprobs(FILEDESC *fp) { static bool did_noprobs = FALSE; @@ -1036,8 +1011,7 @@ sum_noprobs(fp) } int -max(i, j) - int i, j; +max(int i, int j) { return (i >= j ? i : j); } @@ -1047,8 +1021,7 @@ max(i, j) * Assocatiate a FILE * with the given FILEDESC. */ void -open_fp(fp) - FILEDESC *fp; +open_fp(FILEDESC *fp) { if (fp->inf == NULL && (fp->inf = fdopen(fp->fd, "r")) == NULL) { perror(fp->path); @@ -1061,8 +1034,7 @@ open_fp(fp) * Open up the dat file if we need to. */ void -open_dat(fp) - FILEDESC *fp; +open_dat(FILEDESC *fp) { if (fp->datfd < 0 && (fp->datfd = open(fp->datfile, 0)) < 0) { perror(fp->datfile); @@ -1076,8 +1048,7 @@ open_dat(fp) * return a random number. */ void -get_pos(fp) - FILEDESC *fp; +get_pos(FILEDESC *fp) { #ifdef OK_TO_WRITE_DISK int fd; @@ -1109,8 +1080,7 @@ get_pos(fp) * Get the tbl data file the datfile. */ void -get_tbl(fp) - FILEDESC *fp; +get_tbl(FILEDESC *fp) { int fd; FILEDESC *child; @@ -1181,8 +1151,7 @@ get_tbl(fp) * Zero out the fields we care about in a tbl structure. */ void -zero_tbl(tp) - STRFILE *tp; +zero_tbl(STRFILE *tp) { tp->str_numstr = 0; tp->str_longlen = 0; @@ -1194,8 +1163,7 @@ zero_tbl(tp) * Merge the tbl data of t2 into t1. */ void -sum_tbl(t1, t2) - STRFILE *t1, *t2; +sum_tbl(STRFILE *t1, STRFILE *t2) { t1->str_numstr += t2->str_numstr; if (t1->str_longlen < t2->str_longlen) @@ -1211,7 +1179,7 @@ sum_tbl(t1, t2) * Print out the file list */ void -print_file_list() +print_file_list(void) { print_list(File_list, 0); } @@ -1221,9 +1189,7 @@ print_file_list() * Print out the actual list, recursively. */ void -print_list(list, lev) - FILEDESC *list; - int lev; +print_list(FILEDESC *list, int lev) { while (list != NULL) { fprintf(stderr, "%*s", lev * 4, ""); @@ -1247,8 +1213,7 @@ print_list(list, lev) * Convert the pattern to an ignore-case equivalent. */ char * -conv_pat(orig) - char *orig; +conv_pat(char *orig) { char *sp; unsigned int cnt; @@ -1290,7 +1255,7 @@ conv_pat(orig) * Find all the fortunes which match the pattern we've been given. */ int -find_matches() +find_matches(void) { Fort_len = maxlen_in_list(File_list); DPRINTF(2, (stderr, "Maximum length is %d\n", Fort_len)); @@ -1308,8 +1273,7 @@ find_matches() * Return the maximum fortune len in the file list. */ int -maxlen_in_list(list) - FILEDESC *list; +maxlen_in_list(FILEDESC *list) { FILEDESC *fp; int len, maxlen; @@ -1334,8 +1298,7 @@ maxlen_in_list(list) * Print out the matches from the files in the list. */ void -matches_in_list(list) - FILEDESC *list; +matches_in_list(FILEDESC *list) { char *sp; FILEDESC *fp; @@ -1373,7 +1336,7 @@ matches_in_list(list) # endif /* NO_REGEX */ void -usage() +usage(void) { (void) fprintf(stderr, "fortune [-ae"); #ifdef DEBUG diff --git a/games/fortune/strfile/strfile.c b/games/fortune/strfile/strfile.c index 1223bfd7f3d..d9088958536 100644 --- a/games/fortune/strfile/strfile.c +++ b/games/fortune/strfile/strfile.c @@ -1,4 +1,4 @@ -/* $OpenBSD: strfile.c,v 1.13 2003/06/03 03:01:39 millert Exp $ */ +/* $OpenBSD: strfile.c,v 1.14 2004/07/09 15:59:26 deraadt Exp $ */ /* $NetBSD: strfile.c,v 1.4 1995/04/24 12:23:09 cgd Exp $ */ /*- @@ -43,7 +43,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)strfile.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$OpenBSD: strfile.c,v 1.13 2003/06/03 03:01:39 millert Exp $"; +static char rcsid[] = "$OpenBSD: strfile.c,v 1.14 2004/07/09 15:59:26 deraadt Exp $"; #endif #endif /* not lint */ @@ -138,9 +138,7 @@ void usage(void); * and then seek back to the beginning to write in the table. */ int -main(ac, av) - int ac; - char **av; +main(int ac, char *av[]) { char *sp, dc; FILE *inf, *outf; @@ -256,9 +254,7 @@ main(ac, av) * This routine evaluates arguments from the command line */ void -getargs(argc, argv) - int argc; - char **argv; +getargs(int argc, char *argv[]) { extern char *optarg; extern int optind; @@ -311,7 +307,7 @@ getargs(argc, argv) } void -usage() +usage(void) { (void) fprintf(stderr, "strfile [-iorsx] [-c char] sourcefile [datafile]\n"); @@ -323,9 +319,7 @@ usage() * Add an offset to the list, or write it out, as appropriate. */ void -add_offset(fp, off) - FILE *fp; - int32_t off; +add_offset(FILE *fp, int32_t off) { int32_t net; @@ -344,7 +338,7 @@ add_offset(fp, off) * Order the strings alphabetically (possibly ignoring case). */ void -do_order() +do_order(void) { int i; int32_t *lp; @@ -368,8 +362,7 @@ do_order() * Compare two strings in the file */ char * -unctrl(c) - char c; +unctrl(char c) { static char buf[3]; @@ -389,8 +382,7 @@ unctrl(c) } int -cmp_str(p1, p2) - const void *p1, *p2; +cmp_str(const void *p1, const void *p2) { int c1, c2; int n1, n2; @@ -441,7 +433,7 @@ cmp_str(p1, p2) * randomization is done within each block. */ void -randomize() +randomize(void) { int cnt, i; int32_t tmp; diff --git a/games/fortune/unstr/unstr.c b/games/fortune/unstr/unstr.c index d0c5be2d888..f230a7563bd 100644 --- a/games/fortune/unstr/unstr.c +++ b/games/fortune/unstr/unstr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: unstr.c,v 1.8 2003/06/03 03:01:39 millert Exp $ */ +/* $OpenBSD: unstr.c,v 1.9 2004/07/09 15:59:26 deraadt Exp $ */ /* $NetBSD: unstr.c,v 1.3 1995/03/23 08:29:00 cgd Exp $ */ /*- @@ -74,9 +74,7 @@ void order_unstr(STRFILE *); /* ARGSUSED */ int -main(ac, av) - int ac; - char **av; +main(int ac, char *av[]) { static STRFILE tbl; /* description table */ @@ -101,8 +99,7 @@ main(ac, av) } void -getargs(av) - char *av[]; +getargs(char *av[]) { if (!*++av) { (void) fprintf(stderr, "usage: unstr datafile\n"); @@ -115,8 +112,7 @@ getargs(av) } void -order_unstr(tbl) - STRFILE *tbl; +order_unstr(STRFILE *tbl) { unsigned int i; char *sp; diff --git a/games/primes/primes.c b/games/primes/primes.c index 407dece2a38..71301aa7796 100644 --- a/games/primes/primes.c +++ b/games/primes/primes.c @@ -1,4 +1,4 @@ -/* $OpenBSD: primes.c,v 1.12 2003/06/03 03:01:40 millert Exp $ */ +/* $OpenBSD: primes.c,v 1.13 2004/07/09 15:59:26 deraadt Exp $ */ /* $NetBSD: primes.c,v 1.5 1995/04/24 12:24:47 cgd Exp $ */ /* @@ -43,7 +43,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)primes.c 8.5 (Berkeley) 5/10/95"; #else -static char rcsid[] = "$OpenBSD: primes.c,v 1.12 2003/06/03 03:01:40 millert Exp $"; +static char rcsid[] = "$OpenBSD: primes.c,v 1.13 2004/07/09 15:59:26 deraadt Exp $"; #endif #endif /* not lint */ @@ -110,9 +110,7 @@ ubig read_num_buf(void); void usage(void); int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { ubig start; /* where to start generating */ ubig stop; /* don't generate at or above this value */ @@ -187,7 +185,7 @@ main(argc, argv) * This routine returns a number n, where 0 <= n && n <= BIG. */ ubig -read_num_buf() +read_num_buf(void) { ubig val; char *p, buf[100]; /* > max number of digits. */ @@ -218,11 +216,11 @@ read_num_buf() /* * primes - sieve and print primes from start up to and but not including stop + * start: where to start generating + * stop : don't generate at or above this value */ void -primes(start, stop) - ubig start; /* where to start generating */ - ubig stop; /* don't generate at or above this value */ +primes(ubig start, ubig stop) { char *q; /* sieve spot */ ubig factor; /* index and factor */ @@ -333,7 +331,7 @@ primes(start, stop) } void -usage() +usage(void) { (void)fprintf(stderr, "usage: primes [start [stop]]\n"); exit(1); |