Skip to content

Commit 9fe5400

Browse files
committed
WARNSify
1 parent d9715c0 commit 9fe5400

File tree

15 files changed

+320
-206
lines changed

15 files changed

+320
-206
lines changed

games/mille/comp.c

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $NetBSD: comp.c,v 1.4 1995/03/24 05:01:11 cgd Exp $ */
1+
/* $NetBSD: comp.c,v 1.5 1997/10/12 00:53:45 lukem Exp $ */
22

33
/*
44
* Copyright (c) 1982, 1993
@@ -33,11 +33,12 @@
3333
* SUCH DAMAGE.
3434
*/
3535

36+
#include <sys/cdefs.h>
3637
#ifndef lint
3738
#if 0
3839
static char sccsid[] = "@(#)comp.c 8.1 (Berkeley) 5/31/93";
3940
#else
40-
static char rcsid[] = "$NetBSD: comp.c,v 1.4 1995/03/24 05:01:11 cgd Exp $";
41+
__RCSID("$NetBSD: comp.c,v 1.5 1997/10/12 00:53:45 lukem Exp $");
4142
#endif
4243
#endif /* not lint */
4344

@@ -49,17 +50,18 @@ static char rcsid[] = "$NetBSD: comp.c,v 1.4 1995/03/24 05:01:11 cgd Exp $";
4950

5051
# define V_VALUABLE 40
5152

53+
void
5254
calcmove()
5355
{
54-
register CARD card;
55-
register int *value;
56-
register PLAY *pp, *op;
57-
register bool foundend, cango, canstop, foundlow;
58-
register unsgn int i, count200, badcount, nummin, nummax, diff;
59-
register int curmin, curmax;
60-
register CARD safe, oppos;
61-
int valbuf[HAND_SZ], count[NUM_CARDS];
62-
bool playit[HAND_SZ];
56+
CARD card;
57+
int *value;
58+
PLAY *pp, *op;
59+
bool foundend, cango, canstop, foundlow;
60+
unsgn int i, count200, badcount, nummin, nummax, diff;
61+
int curmin, curmax;
62+
CARD safe, oppos;
63+
int valbuf[HAND_SZ], count[NUM_CARDS];
64+
bool playit[HAND_SZ];
6365

6466
wmove(Score, ERR_Y, ERR_X); /* get rid of error messages */
6567
wclrtoeol(Score);
@@ -78,7 +80,7 @@ calcmove()
7880
switch (card) {
7981
case C_STOP: case C_CRASH:
8082
case C_FLAT: case C_EMPTY:
81-
if (playit[i] = canplay(pp, op, card))
83+
if ((playit[i] = canplay(pp, op, card)) != 0)
8284
canstop = TRUE;
8385
goto norm;
8486
case C_LIMIT:
@@ -404,17 +406,18 @@ calcmove()
404406
/*
405407
* Return true if the given player could conceivably win with his next card.
406408
*/
409+
int
407410
onecard(pp)
408-
register PLAY *pp;
411+
PLAY *pp;
409412
{
410-
register CARD bat, spd, card;
413+
CARD bat, spd, card;
411414

412415
bat = pp->battle;
413416
spd = pp->speed;
414417
card = -1;
415418
if (pp->can_go || ((isrepair(bat) || bat == C_STOP || spd == C_LIMIT) &&
416419
Numseen[S_RIGHT_WAY] != 0) ||
417-
bat >= 0 && Numseen[safety(bat)] != 0)
420+
(bat >= 0 && Numseen[safety(bat)] != 0))
418421
switch (End - pp->mileage) {
419422
case 200:
420423
if (pp->nummiles[C_200] == 2)
@@ -436,9 +439,10 @@ register PLAY *pp;
436439
return FALSE;
437440
}
438441

442+
int
439443
canplay(pp, op, card)
440-
register PLAY *pp, *op;
441-
register CARD card;
444+
PLAY *pp, *op;
445+
CARD card;
442446
{
443447
switch (card) {
444448
case C_200:

games/mille/end.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $NetBSD: end.c,v 1.5 1997/05/23 23:09:36 jtc Exp $ */
1+
/* $NetBSD: end.c,v 1.6 1997/10/12 00:53:51 lukem Exp $ */
22

33
/*
44
* Copyright (c) 1982, 1993
@@ -33,11 +33,12 @@
3333
* SUCH DAMAGE.
3434
*/
3535

36+
#include <sys/cdefs.h>
3637
#ifndef lint
3738
#if 0
3839
static char sccsid[] = "@(#)end.c 8.1 (Berkeley) 5/31/93";
3940
#else
40-
static char rcsid[] = "$NetBSD: end.c,v 1.5 1997/05/23 23:09:36 jtc Exp $";
41+
__RCSID("$NetBSD: end.c,v 1.6 1997/10/12 00:53:51 lukem Exp $");
4142
#endif
4243
#endif /* not lint */
4344

@@ -51,10 +52,11 @@ static char rcsid[] = "$NetBSD: end.c,v 1.5 1997/05/23 23:09:36 jtc Exp $";
5152
* print out the score as if it was final, and add the totals for
5253
* the end-of-games points to the user who deserves it (if any).
5354
*/
55+
void
5456
finalscore(pp)
55-
register PLAY *pp;
57+
PLAY *pp;
5658
{
57-
register int temp, tot, num;
59+
int temp, tot, num;
5860

5961
if (pp->was_finished == Finished)
6062
return;
@@ -151,4 +153,3 @@ undoex() {
151153
}
152154
}
153155
# endif
154-

games/mille/extern.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $NetBSD: extern.c,v 1.4 1995/03/24 05:01:36 cgd Exp $ */
1+
/* $NetBSD: extern.c,v 1.5 1997/10/12 00:53:55 lukem Exp $ */
22

33
/*
44
* Copyright (c) 1982, 1993
@@ -33,11 +33,12 @@
3333
* SUCH DAMAGE.
3434
*/
3535

36+
#include <sys/cdefs.h>
3637
#ifndef lint
3738
#if 0
3839
static char sccsid[] = "@(#)extern.c 8.1 (Berkeley) 5/31/93";
3940
#else
40-
static char rcsid[] = "$NetBSD: extern.c,v 1.4 1995/03/24 05:01:36 cgd Exp $";
41+
__RCSID("$NetBSD: extern.c,v 1.5 1997/10/12 00:53:55 lukem Exp $");
4142
#endif
4243
#endif /* not lint */
4344

games/mille/init.c

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $NetBSD: init.c,v 1.6 1997/05/23 23:09:37 jtc Exp $ */
1+
/* $NetBSD: init.c,v 1.7 1997/10/12 00:53:59 lukem Exp $ */
22

33
/*
44
* Copyright (c) 1982, 1993
@@ -33,11 +33,12 @@
3333
* SUCH DAMAGE.
3434
*/
3535

36+
#include <sys/cdefs.h>
3637
#ifndef lint
3738
#if 0
3839
static char sccsid[] = "@(#)init.c 8.1 (Berkeley) 5/31/93";
3940
#else
40-
static char rcsid[] = "$NetBSD: init.c,v 1.6 1997/05/23 23:09:37 jtc Exp $";
41+
__RCSID("$NetBSD: init.c,v 1.7 1997/10/12 00:53:59 lukem Exp $");
4142
#endif
4243
#endif /* not lint */
4344

@@ -47,13 +48,14 @@ static char rcsid[] = "$NetBSD: init.c,v 1.6 1997/05/23 23:09:37 jtc Exp $";
4748
* @(#)init.c 1.1 (Berkeley) 4/1/82
4849
*/
4950

50-
init() {
51+
void
52+
init()
53+
{
54+
PLAY *pp;
55+
int i, j;
56+
CARD card;
5157

52-
register PLAY *pp;
53-
register int i, j;
54-
register CARD card;
55-
56-
bzero(Numseen, sizeof Numseen);
58+
memset(Numseen, 0, sizeof Numseen);
5759
Numgos = 0;
5860

5961
for (i = 0; i < 2; i++) {
@@ -90,15 +92,16 @@ init() {
9092
End = 700;
9193
}
9294

93-
shuffle() {
94-
95-
register int i, r;
96-
register CARD temp;
95+
void
96+
shuffle()
97+
{
98+
int i, r;
99+
CARD temp;
97100

98101
for (i = 0; i < DECK_SZ; i++) {
99102
r = roll(1, DECK_SZ) - 1;
100103
if (r < 0 || r > DECK_SZ - 1) {
101-
fprintf(stderr, "shuffle: card no. error: %d\n", r);
104+
warnx("shuffle: card no. error: %d", r);
102105
die(1);
103106
}
104107
temp = Deck[r];
@@ -108,10 +111,11 @@ shuffle() {
108111
Topcard = &Deck[DECK_SZ];
109112
}
110113

111-
newboard() {
112-
113-
register int i;
114-
register PLAY *pp;
114+
void
115+
newboard()
116+
{
117+
int i;
118+
PLAY *pp;
115119
static int first = TRUE;
116120

117121
if (first) {
@@ -166,10 +170,11 @@ newboard() {
166170
newscore();
167171
}
168172

169-
newscore() {
170-
171-
register int i, new;
172-
register PLAY *pp;
173+
void
174+
newscore()
175+
{
176+
int i, new;
177+
PLAY *pp;
173178
static int was_full = -1;
174179
static int last_win = -1;
175180

games/mille/mille.6

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.\" $NetBSD: mille.6,v 1.5 1997/01/07 12:13:41 tls Exp $
1+
.\" $NetBSD: mille.6,v 1.6 1997/10/12 00:54:03 lukem Exp $
22
.\"
33
.\" Copyright (c) 1983, 1993
44
.\" The Regents of the University of California. All rights reserved.
@@ -38,7 +38,7 @@
3838
.SH NAME
3939
mille \- play Mille Bornes
4040
.SH SYNOPSIS
41-
.B /usr/games/mille
41+
.B mille
4242
[ file ]
4343
.SH DESCRIPTION
4444
.I Mille

games/mille/mille.c

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $NetBSD: mille.c,v 1.5 1997/05/23 23:09:38 jtc Exp $ */
1+
/* $NetBSD: mille.c,v 1.6 1997/10/12 00:54:07 lukem Exp $ */
22

33
/*
44
* Copyright (c) 1982, 1993
@@ -33,17 +33,17 @@
3333
* SUCH DAMAGE.
3434
*/
3535

36+
#include <sys/cdefs.h>
3637
#ifndef lint
37-
static char copyright[] =
38-
"@(#) Copyright (c) 1982, 1993\n\
39-
The Regents of the University of California. All rights reserved.\n";
38+
__COPYRIGHT("@(#) Copyright (c) 1982, 1993\n\
39+
The Regents of the University of California. All rights reserved.\n");
4040
#endif /* not lint */
4141

4242
#ifndef lint
4343
#if 0
4444
static char sccsid[] = "@(#)mille.c 8.1 (Berkeley) 5/31/93";
4545
#else
46-
static char rcsid[] = "$NetBSD: mille.c,v 1.5 1997/05/23 23:09:38 jtc Exp $";
46+
__RCSID("$NetBSD: mille.c,v 1.6 1997/10/12 00:54:07 lukem Exp $");
4747
#endif
4848
#endif /* not lint */
4949

@@ -57,13 +57,12 @@ static char rcsid[] = "$NetBSD: mille.c,v 1.5 1997/05/23 23:09:38 jtc Exp $";
5757
* @(#)mille.c 1.3 (Berkeley) 5/10/83
5858
*/
5959

60-
void rub();
61-
60+
int
6261
main(ac, av)
63-
register int ac;
64-
register char *av[];
62+
int ac;
63+
char *av[];
6564
{
66-
register bool restore;
65+
bool restore;
6766

6867
/* run as the user */
6968
setuid(getuid());
@@ -146,8 +145,9 @@ register char *av[];
146145
* quit.
147146
*/
148147
void
149-
rub() {
150-
148+
rub(dummy)
149+
int dummy;
150+
{
151151
(void)signal(SIGINT, SIG_IGN);
152152
if (getyn(REALLYPROMPT))
153153
die(0);
@@ -157,8 +157,10 @@ rub() {
157157
/*
158158
* Time to go beddy-by
159159
*/
160+
void
160161
die(code)
161-
int code; {
162+
int code;
163+
{
162164

163165
(void)signal(SIGINT, SIG_IGN);
164166
if (outf)

games/mille/mille.h

Lines changed: 46 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $NetBSD: mille.h,v 1.6 1997/05/23 23:09:39 jtc Exp $ */
1+
/* $NetBSD: mille.h,v 1.7 1997/10/12 00:54:11 lukem Exp $ */
22

33
/*
44
* Copyright (c) 1982, 1993
@@ -36,10 +36,17 @@
3636
*/
3737

3838
# include <sys/types.h>
39+
# include <sys/uio.h>
40+
# include <sys/stat.h>
3941
# include <ctype.h>
42+
# include <err.h>
43+
# include <errno.h>
4044
# include <curses.h>
41-
# include <termios.h>
45+
# include <fcntl.h>
46+
# include <stdlib.h>
4247
# include <string.h>
48+
# include <termios.h>
49+
# include <unistd.h>
4350

4451
/*
4552
* @(#)mille.h 1.1 (Berkeley) 4/1/82
@@ -218,4 +225,40 @@ extern WINDOW *Board, *Miles, *Score;
218225
* functions
219226
*/
220227

221-
CARD getcard();
228+
void account __P((CARD));
229+
void calcmove __P((void));
230+
int canplay __P((PLAY *, PLAY *, CARD));
231+
int check_ext __P((bool));
232+
void check_go __P((void));
233+
void check_more __P((void));
234+
void die __P((int));
235+
void domove __P((void));
236+
bool error __P((char *, ...));
237+
void extrapolate __P((PLAY *));
238+
void finalscore __P((PLAY *));
239+
CARD getcard __P((void));
240+
void getmove __P((void));
241+
int getyn __P((int));
242+
int haspicked __P((PLAY *));
243+
void init __P((void));
244+
int isrepair __P((CARD));
245+
int main __P((int, char **));
246+
void newboard __P((void));
247+
void newscore __P((void));
248+
int onecard __P((PLAY *));
249+
int playcard __P((PLAY *));
250+
void prboard __P((void));
251+
void prompt __P((int));
252+
void prscore __P((int));
253+
int readch __P((void));
254+
bool rest_f __P((char *));
255+
int roll __P((int, int));
256+
void rub __P((int));
257+
int safety __P((CARD));
258+
bool save __P((void));
259+
void show_card __P((int, int, CARD, CARD *));
260+
void show_score __P((int, int, int, int *));
261+
void shuffle __P((void));
262+
void sort __P((CARD *));
263+
void undoex __P((int));
264+
bool varpush __P((int, ssize_t __P((int, const struct iovec *, int))));

0 commit comments

Comments
 (0)