src/games WARNS 6 cleanups
------=_Part_646_23523587.1110899991863
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Here are patches that cleanup
bs
worm
worms
wump
grdc
to WARNS 6 levels. All are small except bs which was almost totally
redone. There are still more cleanups to do to these, but it's a
start.
-Craig
--
-----------------------------------------------------------------------
Craig Dooley <xlnxminusx@gmail.com>
------=_Part_646_23523587.1110899991863
Content-Type: text/plain; name="bs-warns6.patch.txt"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment; filename="bs-warns6.patch.txt"
Index: games/bs/Makefile
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/dcvs/src/games/bs/Makefile,v
retrieving revision 1.2
diff -u -r1.2 Makefile
--- games/bs/Makefile=0917 Jun 2003 04:25:23 -0000=091.2
+++ games/bs/Makefile=0915 Mar 2005 13:53:04 -0000
@@ -6,5 +6,6 @@
DPADD=3D ${LIBNCURSES} ${LIBMYTINFO}
LDADD=3D -lncurses -lmytinfo
HIDEGAME=3Dhidegame
+WARNS?=3D=096
=20
.include <bsd.prog.mk>
Index: games/bs/bs.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/dcvs/src/games/bs/bs.c,v
retrieving revision 1.4
diff -u -r1.4 bs.c
--- games/bs/bs.c=0912 Nov 2003 14:53:52 -0000=091.4
+++ games/bs/bs.c=0915 Mar 2005 13:50:46 -0000
@@ -60,14 +60,14 @@
#define PXBASE=093
#define PY(y)=09(PYBASE + (y))
#define PX(x)=09(PXBASE + (x)*3)
-#define pgoto(y, x)=09(void)move(PY(y), PX(x))
+#define pgoto(y, x)=09move(PY(y), PX(x))
=20
/* how to position us on cpu board */
#define CYBASE=093
#define CXBASE=0948
#define CY(y)=09(CYBASE + (y))
#define CX(x)=09(CXBASE + (x)*3)
-#define cgoto(y, x)=09(void)move(CY(y), CX(x))
+#define cgoto(y, x)=09move(CY(y), CX(x))
=20
#define ONBOARD(x, y)=09(x >=3D 0 && x < BWIDTH && y >=3D 0 && y < BDEPTH)
=20
@@ -102,34 +102,33 @@
static int curx =3D (BWIDTH / 2);
static int cury =3D (BDEPTH / 2);
=20
-typedef struct
-{
- char *name;=09=09/* name of the ship type */
- unsigned int hits;=09/* how many times has this ship been hit? */
- char symbol;=09/* symbol for game purposes */
- char length;=09/* length of ship */
- char x, y;=09=09/* coordinates of ship start point */
- enum directions dir;/* direction of `bow' */
- bool placed;=09/* has it been placed on the board? */
+typedef struct {
+ char *name;=09=09=09=09/* name of the ship type */
+ char hits;=09=09=09=09/* how many times has this ship been hit? */
+ char symbol;=09=09=09/* symbol for game purposes */
+ char length;=09=09=09/* length of ship */
+ char x, y;=09=09=09=09/* coordinates of ship start point */
+ enum directions dir;=09/* direction of `bow' */
+ bool placed;=09=09=09/* has it been placed on the board? */
}
ship_t;
=20
ship_t plyship[SHIPTYPES] =3D
{
- { carrier,=090, 'A', 5},
- { battle,=090, 'B', 4},
- { destroy,=090, 'D', 3},
- { sub,=090, 'S', 3},
- { ptboat,=090, 'P', 2},
+ { carrier,=090, 'A', 5, 0, 0, E, FALSE},
+ { battle,=090, 'B', 4, 0, 0, E, FALSE},
+ { destroy,=090, 'D', 3, 0, 0, E, FALSE},
+ { sub,=09=090, 'S', 3, 0, 0, E, FALSE},
+ { ptboat,=090, 'P', 2, 0, 0, E, FALSE},
};
=20
ship_t cpuship[SHIPTYPES] =3D
{
- { carrier,=090, 'A', 5},
- { battle,=090, 'B', 4},
- { destroy,=090, 'D', 3},
- { sub,=090, 'S', 3},
- { ptboat,=090, 'P', 2},
+ { carrier,=090, 'A', 5, 0, 0, E, FALSE},
+ { battle,=090, 'B', 4, 0, 0, E, FALSE},
+ { destroy,=090, 'D', 3, 0, 0, E, FALSE},
+ { sub,=09=090, 'S', 3, 0, 0, E, FALSE},
+ { ptboat,=090, 'P', 2, 0, 0, E, FALSE},
};
=20
/* "Hits" board, and main board. */
@@ -140,82 +139,79 @@
=20
static int salvo, blitz, closepack;
=20
-#define=09PR=09(void)addstr
+#define=09PR=09addstr
=20
static bool checkplace (int, ship_t *, int);
static int getcoord (int);
int playagain (void);
=20
-static void uninitgame(sig)
/* end the game, either normally or due to signal */
-int=09sig;
-{
+static void uninitgame(void) {
clear();
- (void)refresh();
- (void)resetterm();
- (void)echo();
- (void)endwin();
+ refresh();
+ resetterm();
+ echo();
+ endwin();
exit(0);
}
=20
-static void announceopts()
+static void sighandler(__unused int sig) {
+=09uninitgame();
+}
+
/* announce which game options are enabled */
-{
- if (salvo || blitz || closepack)
- {
-=09(void) printw("Playing optional game (");
+static void announceopts(void) {
+ printw("Playing %s game (", (salvo || blitz || closepack) ?
+=09=09=09"optional" : "standard");
+=09
=09if (salvo)
-=09 (void) printw("salvo, ");
+=09 printw("salvo, ");
=09else
-=09 (void) printw("nosalvo, ");
+=09 printw("nosalvo, ");
+
=09if (blitz)
-=09 (void) printw("blitz ");
+=09 printw("blitz, ");
=09else
-=09 (void) printw("noblitz, ");
+=09 printw("noblitz, ");
+
=09if (closepack)
-=09 (void) printw("closepack)");
+=09 printw("closepack)");
=09else
-=09 (void) printw("noclosepack)");
- }
- else
-=09(void) printw(
-=09"Playing standard game (noblitz, nosalvo, noclosepack)");
+=09 printw("noclosepack)");
}
=20
-static void intro()
-{
+static void intro(void) {
char *tmpname;
=20
srandomdev();
=20
tmpname =3D getlogin();
- (void) signal(SIGINT,uninitgame);
- (void) signal(SIGINT,uninitgame);
- (void) signal(SIGIOT,uninitgame);=09=09/* for assert(3) */
+ signal(SIGINT,sighandler);
+ signal(SIGINT,sighandler);
+ signal(SIGIOT,sighandler);=09=09/* for assert(3) */
if(signal(SIGQUIT,SIG_IGN) !=3D SIG_IGN)
-=09(void)signal(SIGQUIT,uninitgame);
+=09=09signal(SIGQUIT,sighandler);
=20
- if(tmpname !=3D '\0')
- {
-=09(void)strcpy(name,tmpname);
-=09name[0] =3D toupper(name[0]);
- }
- else
-=09(void)strcpy(name,dftname);
+ if(tmpname !=3D '\0') {
+=09=09strcpy(name,tmpname);
+=09=09name[0] =3D toupper(name[0]);
+ } else {
+=09=09strcpy(name,dftname);
+=09}
=20
- (void)initscr();
+ initscr();
#ifdef KEY_MIN
keypad(stdscr, TRUE);
#endif /* KEY_MIN */
- (void)saveterm();
- (void)nonl();
- (void)cbreak();
- (void)noecho();
+ saveterm();
+ nonl();
+ cbreak();
+ noecho();
=20
#ifdef PENGUIN
- (void)clear();
- (void)mvaddstr(4,29,"Welcome to Battleship!");
- (void)move(8,0);
+ clear();
+ mvaddstr(4,29,"Welcome to Battleship!");
+ move(8,0);
PR(" \\\n");
PR(" \\ \\ \\\n");
PR(" \\ \\ \\ \\ \\________=
_____\n");
@@ -227,8 +223,8 @@
PR(" \\ =
/\n");
PR(" \\___________________________________________________=
/\n");
=20
- (void) mvaddstr(22,27,"Hit any key to continue..."); (void)refresh();
- (void) getch();
+ mvaddstr(22,27,"Hit any key to continue..."); refresh();
+ getch();
#endif /* PENGUIN */
=20
#ifdef A_COLOR
@@ -246,154 +242,139 @@
=20
}
=20
-/* VARARGS1 */
-static void prompt(n, f, s)
/* print a message at the prompt line */
-int n;
-char *f, *s;
-{
- (void) move(PROMPTLINE + n, 0);
- (void) clrtoeol();
- (void) printw(f, s);
- (void) refresh();
+static void prompt(int n, const char *f, ...) {
+=09va_list ap;
+=09char=09buf[COLWIDTH + 1];
+
+=09va_start(ap, f);
+ move(PROMPTLINE + n, 0);
+ clrtoeol();
+=09vsnprintf(buf, COLWIDTH + 1, f, ap);
+ printw("%s", buf);
+ refresh();
+=09va_end(ap);
}
=20
-static void error(s)
-char *s;
-{
- (void) move(PROMPTLINE + 2, 0);
- (void) clrtoeol();
- if (s)
- {
-=09(void) addstr(s);
-=09(void) beep();
+static void error(const char *s) {
+ move(PROMPTLINE + 2, 0);
+ clrtoeol();
+ if (s) {
+=09=09addstr(s);
+=09=09beep();
}
}
=20
-static void placeship(b, ss, vis)
-int b;
-ship_t *ss;
-int vis;
-{
+static void placeship(int b, ship_t *ss, int vis) {
int l;
=20
- for(l =3D 0; l < ss->length; ++l)
- {
-=09int newx =3D ss->x + l * xincr[ss->dir];
-=09int newy =3D ss->y + l * yincr[ss->dir];
-
-=09board[b][newx][newy] =3D ss->symbol;
-=09if (vis)
-=09{
-=09 pgoto(newy, newx);
-=09 (void) addch((chtype)ss->symbol);
-=09}
+ for(l =3D 0; l < ss->length; ++l) {
+=09=09int newx =3D ss->x + l * xincr[ss->dir];
+=09=09int newy =3D ss->y + l * yincr[ss->dir];
+
+=09=09board[b][newx][newy] =3D ss->symbol;
+=09=09if (vis) {
+=09 =09pgoto(newy, newx);
+=09 =09addch((chtype)ss->symbol);
+=09=09}
}
ss->hits =3D 0;
}
=20
-static int rnd(n)
-int n;
-{
+static int rnd(int n) {
return(random() % n);
}
=20
-static void randomplace(b, ss)
/* generate a valid random ship placement into px,py */
-int b;
-ship_t *ss;
-{
+static void randomplace(int b, ship_t *ss) {
int bwidth =3D BWIDTH - ss->length;
int bdepth =3D BDEPTH - ss->length;
=20
do {
-=09ss->y =3D rnd(bdepth);
-=09ss->x =3D rnd(bwidth);
-=09ss->dir =3D rnd(2) ? E : S;
- } while
-=09(!checkplace(b, ss, FALSE));
+=09=09ss->y =3D rnd(bdepth);
+=09=09ss->x =3D rnd(bwidth);
+=09=09ss->dir =3D rnd(2) ? E : S;
+ } while (!checkplace(b, ss, FALSE));
}
=20
-static void initgame()
-{
+static void initgame(void) {
int i, j, unplaced;
ship_t *ss;
=20
- (void) clear();
- (void) mvaddstr(0,35,"BATTLESHIPS");
- (void) move(PROMPTLINE + 2, 0);
+ clear();
+ mvaddstr(0,35,"BATTLESHIPS");
+ move(PROMPTLINE + 2, 0);
announceopts();
=20
bzero(board, sizeof(char) * BWIDTH * BDEPTH * 2);
bzero(hits, sizeof(char) * BWIDTH * BDEPTH * 2);
- for (i =3D 0; i < SHIPTYPES; i++)
- {
-=09ss =3D cpuship + i;
-=09ss->x =3D ss->y =3D ss->dir =3D ss->hits =3D ss->placed =3D 0;
-=09ss =3D plyship + i;
-=09ss->x =3D ss->y =3D ss->dir =3D ss->hits =3D ss->placed =3D 0;
+ for (i =3D 0; i < SHIPTYPES; i++) {
+=09=09ss =3D cpuship + i;
+=09=09ss->x =3D ss->y =3D ss->dir =3D ss->hits =3D ss->placed =3D 0;
+=09=09ss =3D plyship + i;
+=09=09ss->x =3D ss->y =3D ss->dir =3D ss->hits =3D ss->placed =3D 0;
}
=20
/* draw empty boards */
- (void) mvaddstr(PYBASE - 2, PXBASE + 5, "Main Board");
- (void) mvaddstr(PYBASE - 1, PXBASE - 3,numbers);
+ mvaddstr(PYBASE - 2, PXBASE + 5, "Main Board");
+ mvaddstr(PYBASE - 1, PXBASE - 3,numbers);
for(i=3D0; i < BDEPTH; ++i)
{
-=09(void) mvaddch(PYBASE + i, PXBASE - 3, i + 'A');
+=09mvaddch(PYBASE + i, PXBASE - 3, i + 'A');
#ifdef A_COLOR
=09if (has_colors())
=09 attron(COLOR_PAIR(COLOR_BLUE));
#endif /* A_COLOR */
-=09(void) addch(' ');
+=09addch(' ');
=09for (j =3D 0; j < BWIDTH; j++)
-=09 (void) addstr(" . ");
+=09 addstr(" . ");
#ifdef A_COLOR
=09attrset(0);
#endif /* A_COLOR */
-=09(void) addch(' ');
-=09(void) addch(i + 'A');
+=09addch(' ');
+=09addch(i + 'A');
}
- (void) mvaddstr(PYBASE + BDEPTH, PXBASE - 3,numbers);
- (void) mvaddstr(CYBASE - 2, CXBASE + 7,"Hit/Miss Board");
- (void) mvaddstr(CYBASE - 1, CXBASE - 3, numbers);
+ mvaddstr(PYBASE + BDEPTH, PXBASE - 3,numbers);
+ mvaddstr(CYBASE - 2, CXBASE + 7,"Hit/Miss Board");
+ mvaddstr(CYBASE - 1, CXBASE - 3, numbers);
for(i=3D0; i < BDEPTH; ++i)
{
-=09(void) mvaddch(CYBASE + i, CXBASE - 3, i + 'A');
+=09mvaddch(CYBASE + i, CXBASE - 3, i + 'A');
#ifdef A_COLOR
=09if (has_colors())
=09 attron(COLOR_PAIR(COLOR_BLUE));
#endif /* A_COLOR */
-=09(void) addch(' ');
+=09addch(' ');
=09for (j =3D 0; j < BWIDTH; j++)
-=09 (void) addstr(" . ");
+=09 addstr(" . ");
#ifdef A_COLOR
=09attrset(0);
#endif /* A_COLOR */
-=09(void) addch(' ');
-=09(void) addch(i + 'A');
+=09addch(' ');
+=09addch(i + 'A');
}
=20
- (void) mvaddstr(CYBASE + BDEPTH,CXBASE - 3,numbers);
+ mvaddstr(CYBASE + BDEPTH,CXBASE - 3,numbers);
=20
- (void) mvprintw(HYBASE, HXBASE,
+ mvprintw(HYBASE, HXBASE,
=09=09 "To position your ships: move the cursor to a spot, then");
- (void) mvprintw(HYBASE+1,HXBASE,
+ mvprintw(HYBASE+1,HXBASE,
=09=09 "type the first letter of a ship type to select it, then");
- (void) mvprintw(HYBASE+2,HXBASE,
+ mvprintw(HYBASE+2,HXBASE,
=09=09 "type a direction ([hjkl] or [4862]), indicating how the");
- (void) mvprintw(HYBASE+3,HXBASE,
+ mvprintw(HYBASE+3,HXBASE,
=09=09 "ship should be pointed. You may also type a ship letter");
- (void) mvprintw(HYBASE+4,HXBASE,
+ mvprintw(HYBASE+4,HXBASE,
=09=09 "followed by `r' to position it randomly, or type `R' to");
- (void) mvprintw(HYBASE+5,HXBASE,
+ mvprintw(HYBASE+5,HXBASE,
=09=09 "place all remaining ships randomly.");
=20
- (void) mvaddstr(MYBASE, MXBASE, "Aiming keys:");
- (void) mvaddstr(SYBASE, SXBASE, "y k u 7 8 9");
- (void) mvaddstr(SYBASE+1, SXBASE, " \\|/ \\|/ ");
- (void) mvaddstr(SYBASE+2, SXBASE, "h-+-l 4-+-6");
- (void) mvaddstr(SYBASE+3, SXBASE, " /|\\ /|\\ ");
- (void) mvaddstr(SYBASE+4, SXBASE, "b j n 1 2 3");
+ mvaddstr(MYBASE, MXBASE, "Aiming keys:");
+ mvaddstr(SYBASE, SXBASE, "y k u 7 8 9");
+ mvaddstr(SYBASE+1, SXBASE, " \\|/ \\|/ ");
+ mvaddstr(SYBASE+2, SXBASE, "h-+-l 4-+-6");
+ mvaddstr(SYBASE+3, SXBASE, " /|\\ /|\\ ");
+ mvaddstr(SYBASE+4, SXBASE, "b j n 1 2 3");
=20
/* have the computer place ships */
for(ss =3D cpuship; ss < cpuship + SHIPTYPES; ss++)
@@ -421,7 +402,7 @@
=09 (!strchr(docked, c));
=20
=09if (c =3D=3D 'R')
-=09 (void) ungetch('R');
+=09 ungetch('R');
=09else
=09{
=09 /* map that into the corresponding symbol */
@@ -440,8 +421,8 @@
=20
=09if (c =3D=3D FF)
=09{
-=09 (void)clearok(stdscr, TRUE);
-=09 (void)refresh();
+=09 clearok(stdscr, TRUE);
+=09 refresh();
=09}
=09else if (c =3D=3D 'r')
=09{
@@ -491,43 +472,41 @@
=20
turn =3D rnd(2);
=20
- (void) mvprintw(HYBASE, HXBASE,
+ mvprintw(HYBASE, HXBASE,
=09=09 "To fire, move the cursor to your chosen aiming point ");
- (void) mvprintw(HYBASE+1, HXBASE,
+ mvprintw(HYBASE+1, HXBASE,
=09=09 "and strike any key other than a motion key. ");
- (void) mvprintw(HYBASE+2, HXBASE,
+ mvprintw(HYBASE+2, HXBASE,
=09=09 " ");
- (void) mvprintw(HYBASE+3, HXBASE,
+ mvprintw(HYBASE+3, HXBASE,
=09=09 " ");
- (void) mvprintw(HYBASE+4, HXBASE,
+ mvprintw(HYBASE+4, HXBASE,
=09=09 " ");
- (void) mvprintw(HYBASE+5, HXBASE,
+ mvprintw(HYBASE+5, HXBASE,
=09=09 " ");
=20
- (void) prompt(0, "Press any key to start...");
- (void) getch();
+ prompt(0, "Press any key to start...");
+ getch();
}
=20
-static int getcoord(atcpu)
-int atcpu;
-{
+static int getcoord(int atcpu) {
int ny, nx, c;
=20
if (atcpu)
=09cgoto(cury,curx);
else
=09pgoto(cury, curx);
- (void)refresh();
+ refresh();
for (;;)
{
=09if (atcpu)
=09{
-=09 (void) mvprintw(CYBASE + BDEPTH+1, CXBASE+11, "(%d, %c)", curx, 'A'=
+cury);
+=09 mvprintw(CYBASE + BDEPTH+1, CXBASE+11, "(%d, %c)", curx, 'A'+cury);
=09 cgoto(cury, curx);
=09}
=09else
=09{
-=09 (void) mvprintw(PYBASE + BDEPTH+1, PXBASE+11, "(%d, %c)", curx, 'A'=
+cury);
+=09 mvprintw(PYBASE + BDEPTH+1, PXBASE+11, "(%d, %c)", curx, 'A'+cury);
=09 pgoto(cury, curx);
=09}
=20
@@ -583,14 +562,14 @@
=09 break;
=09case FF:
=09 nx =3D curx; ny =3D cury;
-=09 (void)clearok(stdscr, TRUE);
-=09 (void)refresh();
+=09 clearok(stdscr, TRUE);
+=09 refresh();
=09 break;
=09default:
=09 if (atcpu)
-=09=09(void) mvaddstr(CYBASE + BDEPTH + 1, CXBASE + 11, " ");
+=09=09mvaddstr(CYBASE + BDEPTH + 1, CXBASE + 11, " ");
=09 else
-=09=09(void) mvaddstr(PYBASE + BDEPTH + 1, PXBASE + 11, " ");
+=09=09mvaddstr(PYBASE + BDEPTH + 1, PXBASE + 11, " ");
=09 return(c);
=09}
=20
@@ -599,87 +578,76 @@
}
}
=20
-static int collidecheck(b, y, x)
/* is this location on the selected zboard adjacent to a ship? */
-int b;
-int y, x;
-{
+static int collidecheck(int b, int y, int x) {
int=09collide;
=20
/* anything on the square */
if ((collide =3D IS_SHIP(board[b][x][y])) !=3D 0)
-=09return(collide);
+=09=09return(collide);
=20
/* anything on the neighbors */
- if (!closepack)
- {
-=09int i;
+ if (!closepack) {
+=09=09int i;
=20
-=09for (i =3D 0; i < 8; i++)
-=09{
-=09 int xend, yend;
+=09=09for (i =3D 0; i < 8; i++) {
+=09 =09int xend, yend;
+=09
+=09 =09yend =3D y + yincr[i];
+=09 =09xend =3D x + xincr[i];
+=09 =09if (ONBOARD(xend, yend))
+=09=09=09collide +=3D IS_SHIP(board[b][xend][yend]);
+=09=09}
+ =09}
=20
-=09 yend =3D y + yincr[i];
-=09 xend =3D x + xincr[i];
-=09 if (ONBOARD(xend, yend))
-=09=09collide +=3D IS_SHIP(board[b][xend][yend]);
-=09}
- }
return(collide);
}
=20
-static bool checkplace(b, ss, vis)
-int b;
-ship_t *ss;
-int vis;
-{
+static bool checkplace(int b, ship_t *ss, int vis) {
int l, xend, yend;
=20
/* first, check for board edges */
xend =3D ss->x + ss->length * xincr[ss->dir];
yend =3D ss->y + ss->length * yincr[ss->dir];
- if (!ONBOARD(xend, yend))
- {
-=09if (vis)
-=09 switch(rnd(3))
-=09 {
-=09 case 0:
-=09=09error("Ship is hanging from the edge of the world");
-=09=09break;
-=09 case 1:
-=09=09error("Try fitting it on the board");
-=09=09break;
-=09 case 2:
-=09=09error("Figure I won't find it if you put it there?");
-=09=09break;
+ if (!ONBOARD(xend, yend)) {
+=09=09if (vis) {
+=09 =09switch(rnd(3)) {
+=09 =09=09case 0:
+=09=09=09=09=09error("Ship is hanging from the edge of the world");
+=09=09=09=09=09break;
+=09 =09=09case 1:
+=09=09=09=09=09error("Try fitting it on the board");
+=09=09=09=09=09break;
+=09 =09=09case 2:
+=09=09=09=09=09error("Figure I won't find it if you put it there?");
+=09=09=09=09=09break;
+=09=09=09}
=09 }
-=09return(0);
+=09=09return(0);
}
=20
- for(l =3D 0; l < ss->length; ++l)
- {
-=09if(collidecheck(b, ss->y+l*yincr[ss->dir], ss->x+l*xincr[ss->dir]))
-=09{
-=09 if (vis)
-=09=09switch(rnd(3))
-=09=09{
-=09=09 case 0:
-=09=09=09error("There's already a ship there");
-=09=09=09break;
-=09=09 case 1:
-=09=09=09error("Collision alert! Aaaaaagh!");
-=09=09=09break;
-=09=09 case 2:
-=09=09=09error("Er, Admiral, what about the other ship?");
-=09=09=09break;
-=09=09 }
-=09 return(FALSE);
+ for(l =3D 0; l < ss->length; ++l) {
+=09=09if(collidecheck(b, ss->y+l*yincr[ss->dir], ss->x+l*xincr[ss->dir])) =
{
+=09 =09if (vis) {
+=09=09=09=09switch(rnd(3)) {
+=09=09 =09=09case 0:
+=09=09=09=09=09=09error("There's already a ship there");
+=09=09=09=09=09=09break;
+=09=09 =09=09case 1:
+=09=09=09=09=09=09error("Collision alert! Aaaaaagh!");
+=09=09=09=09=09=09break;
+=09=09 =09=09case 2:
+=09=09=09=09=09=09error("Er, Admiral, what about the other ship?");
+=09=09=09=09=09=09break;
+=09=09 =09=09}
+=09=09=09=09}
+=09 =09return(FALSE);
=09 }
=09}
return(TRUE);
}
=20
-static int awinna()
+static int awinna(void)
{
int i, j;
ship_t *ss;
@@ -696,10 +664,8 @@
return(-1);
}
=20
-static ship_t *hitship(x, y)
/* a hit on the targeted ship */
-int x, y;
-{
+static ship_t *hitship(int x, int y) {
ship_t *sb, *ss;
char sym;
int oldx, oldy;
@@ -711,75 +677,71 @@
for(ss =3D sb; ss < sb + SHIPTYPES; ++ss)
=09if(ss->symbol =3D=3D sym)
=09{
-=09 if (++ss->hits < ss->length)=09/* still afloat? */
-=09=09return((ship_t *)NULL);
-=09 else=09=09=09=09/* sunk! */
-=09 {
+=09 if (++ss->hits < ss->length) {=09/* still afloat? */
+=09=09=09return((ship_t *)NULL);
+=09 } else { /* sunk */
=09=09int i, j;
=20
-=09=09if (!closepack)
-=09=09 for (j =3D -1; j <=3D 1; j++)
-=09=09 {
-=09=09=09int bx =3D ss->x + j * xincr[(ss->dir + 2) % 8];
-=09=09=09int by =3D ss->y + j * yincr[(ss->dir + 2) % 8];
-
-=09=09=09for (i =3D -1; i <=3D ss->length; ++i)
-=09=09=09{
-=09=09=09 int x, y;
-
-=09=09=09 x =3D bx + i * xincr[ss->dir];
-=09=09=09 y =3D by + i * yincr[ss->dir];
-=09=09=09 if (ONBOARD(x, y))
-=09=09=09 {
-=09=09=09=09hits[turn][x][y] =3D MARK_MISS;
-=09=09=09=09if (turn % 2 =3D=3D PLAYER)
-=09=09=09=09{
-=09=09=09=09 cgoto(y, x);
+=09=09if (!closepack) {
+=09=09 for (j =3D -1; j <=3D 1; j++) {
+=09=09=09=09int bx =3D ss->x + j * xincr[(ss->dir + 2) % 8];
+=09=09=09=09int by =3D ss->y + j * yincr[(ss->dir + 2) % 8];
+=09
+=09=09=09=09for (i =3D -1; i <=3D ss->length; ++i) {
+=09=09=09 =09int cx, cy;
+=09
+=09=09=09 =09cx =3D bx + i * xincr[ss->dir];
+=09=09=09 =09cy =3D by + i * yincr[ss->dir];
+=09=09=09 =09if (ONBOARD(cx, cy)) {
+=09=09=09=09=09=09hits[turn][cx][cy] =3D MARK_MISS;
+=09=09=09=09=09=09if (turn % 2 =3D=3D PLAYER) {
+=09=09=09=09 =09=09cgoto(cy, cx);
#ifdef A_COLOR
-=09=09=09=09 if (has_colors())
-=09=09=09=09=09attron(COLOR_PAIR(COLOR_GREEN));
+=09=09=09=09 =09=09if (has_colors())
+=09=09=09=09=09=09=09=09attron(COLOR_PAIR(COLOR_GREEN));
#endif /* A_COLOR */
-=09=09=09=09 (void)addch(MARK_MISS);
+=09
+=09=09=09=09 =09=09addch(MARK_MISS);
#ifdef A_COLOR
-=09=09=09=09 attrset(0);
+=09=09=09=09 =09=09attrset(0);
#endif /* A_COLOR */
+=09=09=09=09=09=09}
+=09=09=09 =09}
=09=09=09=09}
-=09=09=09 }
-=09=09=09}
-=09=09 }
+=09 =09}
+=09=09}
=20
=09=09for (i =3D 0; i < ss->length; ++i)
=09=09{
-=09=09 int x =3D ss->x + i * xincr[ss->dir];
-=09=09 int y =3D ss->y + i * yincr[ss->dir];
+=09=09 int dx =3D ss->x + i * xincr[ss->dir];
+=09=09 int dy =3D ss->y + i * yincr[ss->dir];
=20
-=09=09 hits[turn][x][y] =3D ss->symbol;
+=09=09 hits[turn][dx][dy] =3D ss->symbol;
=09=09 if (turn % 2 =3D=3D PLAYER)
=09=09 {
-=09=09=09cgoto(y, x);
-=09=09=09(void) addch(ss->symbol);
+=09=09=09cgoto(dy, dx);
+=09=09=09addch(ss->symbol);
=09=09 }
=09=09}
=20
-=09=09(void) move(oldy, oldx);
+=09=09move(oldy, oldx);
=09=09return(ss);
=09 }
=09}
- (void) move(oldy, oldx);
+ move(oldy, oldx);
return((ship_t *)NULL);
}
=20
-static int plyturn()
-{
+static int plyturn(void) {
ship_t *ss;
bool hit;
- char *m;
+ char const *m;
=20
m =3D NULL;
prompt(1, "Where do you want to shoot? ");
for (;;)
{
-=09(void) getcoord(COMPUTER);
+=09getcoord(COMPUTER);
=09if (hits[PLAYER][curx][cury])
=09{
=09 prompt(1, "You shelled this spot already! Try again.");
@@ -799,7 +761,7 @@
=09 attron(COLOR_PAIR(COLOR_GREEN));
}
#endif /* A_COLOR */
- (void) addch((chtype)hits[PLAYER][curx][cury]);
+ addch((chtype)hits[PLAYER][curx][cury]);
#ifdef A_COLOR
attrset(0);
#endif /* A_COLOR */
@@ -825,43 +787,39 @@
=09 m =3D " You'll pick up survivors from my %s, I hope...!";
=09 break;
=09}
-=09(void)printw(m, ss->name);
-=09(void)beep();
+=09printw(m, ss->name);
+=09beep();
=09return(awinna() =3D=3D -1);
}
return(hit);
}
=20
-static int sgetc(s)
-char *s;
-{
- char *s1;
+static int sgetc(const char *s) {
+ const char *s1;
int ch;
=20
- (void)refresh();
- for(;;)
- {
-=09ch =3D getch();
-=09if (islower(ch))
-=09 ch =3D toupper(ch);
-=09if (ch =3D=3D CTRLC)
-=09 uninitgame();
-=09for (s1=3Ds; *s1 && ch !=3D *s1; ++s1)
-=09 continue;
-=09if (*s1)
-=09{
-=09 (void) addch((chtype)ch);
-=09 (void)refresh();
-=09 return(ch);
-=09 }
+ refresh();
+ for(;;) {
+=09=09ch =3D getch();
+=09=09if (islower(ch))
+=09 =09ch =3D toupper(ch);
+
+=09=09if (ch =3D=3D CTRLC)
+=09 =09uninitgame();
+
+=09=09for (s1=3Ds; *s1 && ch !=3D *s1; ++s1)
+=09 =09continue;
+
+=09=09if (*s1) {
+=09 =09addch((chtype)ch);
+=09 =09refresh();
+=09 =09return(ch);
+=09 =09}
=09}
}
=20
-
-static void randomfire(px, py)
/* random-fire routine -- implements simple diagonal-striping strategy */
-int=09*px, *py;
-{
+static void randomfire(int *px, int *py) {
static int turncount =3D 0;
static int srchstep =3D BEGINSTEP;
static int huntoffs;=09=09/* Offset on search strategy */
@@ -918,22 +876,20 @@
#define S_HIT=091
#define S_SUNK=09-1
=20
-static bool cpufire(x, y)
/* fire away at given location */
-int=09x, y;
-{
+static bool cpufire(int x, int y) {
bool hit, sunk;
ship_t *ss;
=20
ss =3D NULL;
hits[COMPUTER][x][y] =3D (hit =3D (board[PLAYER][x][y])) ? MARK_HIT : =
MARK_MISS;
- (void) mvprintw(PROMPTLINE, 0,
+ mvprintw(PROMPTLINE, 0,
=09"I shoot at %c%d. I %s!", y + 'A', x, hit ? "hit" : "miss");
ss =3D hitship(x, y);
sunk =3D hit && ss;
if (sunk)
-=09(void) printw(" I've sunk your %s", ss->name);
- (void)clrtoeol();
+=09printw(" I've sunk your %s", ss->name);
+ clrtoeol();
=20
pgoto(y, x);
#ifdef A_COLOR
@@ -944,7 +900,7 @@
=09 attron(COLOR_PAIR(COLOR_GREEN));
}
#endif /* A_COLOR */
- (void)addch((chtype)(hit ? SHOWHIT : SHOWSPLASH));
+ addch((chtype)(hit ? SHOWHIT : SHOWSPLASH));
#ifdef A_COLOR
attrset(0);
#endif /* A_COLOR */
@@ -957,8 +913,7 @@
* unstructuredness below. The five labels are states which need to be hel=
d
* between computer turns.
*/
-static bool cputurn()
-{
+static bool cputurn(void) {
#define POSSIBLE(x, y)=09(ONBOARD(x, y) && !hits[COMPUTER][x][y])
#define RANDOM_FIRE=090
#define RANDOM_HIT=091
@@ -1067,43 +1022,45 @@
if (salvo)
{
-=09(void)refresh();
-=09(void)sleep(1);
+=09refresh();
+=09sleep(1);
}
if (awinna() !=3D -1)
=09return(FALSE);
=20
#ifdef DEBUG
- (void) mvprintw(PROMPTLINE + 2, 0,
+ mvprintw(PROMPTLINE + 2, 0,
=09=09 "New state %d, x=3D%d, y=3D%d, d=3D%d",
=09=09 next, x, y, d);
#endif /* DEBUG */
return(hit);
}
=20
-int
-playagain()
-{
+int playagain(void) {
int j;
ship_t *ss;
=20
- for (ss =3D cpuship; ss < cpuship + SHIPTYPES; ss++)
-=09for(j =3D 0; j < ss->length; j++)
-=09{
-=09 cgoto(ss->y + j * yincr[ss->dir], ss->x + j * xincr[ss->dir]);
-=09 (void)addch((chtype)ss->symbol);
+ for (ss =3D cpuship; ss < cpuship + SHIPTYPES; ss++) {
+=09=09for(j =3D 0; j < ss->length; j++) {
+=09 =09cgoto(ss->y + j * yincr[ss->dir], ss->x + j * xincr[ss->dir]);
+=09 =09addch((chtype)ss->symbol);
+=09=09}
+=09}
+
+ if(awinna()) {
+=09=09++cpuwon;
+ } else {
+=09=09++plywon;
=09}
=20
- if(awinna())
-=09++cpuwon;
- else
-=09++plywon;
j =3D 18 + strlen(name);
- if(plywon >=3D 10)
-=09++j;
- if(cpuwon >=3D 10)
-=09++j;
- (void) mvprintw(1,(COLWIDTH-j)/2,
+ if(plywon >=3D 10) {
+=09=09++j;
+ } else if(cpuwon >=3D 10) {
+=09=09++j;
+=09}
+ =20
+=09mvprintw(1,(COLWIDTH-j)/2,
=09=09 "%s: %d Computer: %d",name,plywon,cpuwon);
=20
prompt(2, (awinna()) ? "Want to be humiliated again, %s [yn]? "
@@ -1111,64 +1068,17 @@
return(sgetc("YN") =3D=3D 'Y');
}
=20
-static void do_options(c,op)
-int c;
-char *op[];
-{
- int i;
-
- if (c > 1)
- {
-=09for (i=3D1; i<c; i++)
-=09{
-=09 switch(op[i][0])
-=09 {
-=09 default:
-=09 case '?':
-=09=09(void) fprintf(stderr, "Usage: battle [-s | -b] [-c]\n");
-=09=09(void) fprintf(stderr, "\tWhere the options are:\n");
-=09=09(void) fprintf(stderr, "\t-s : play a salvo game\n");
-=09=09(void) fprintf(stderr, "\t-b : play a blitz game\n");
-=09=09(void) fprintf(stderr, "\t-c : ships may be adjacent\n");
+static void usage(void) {
+=09=09fprintf(stderr, "Usage: battle [-s | -b] [-c]\n");
+=09=09fprintf(stderr, "\tWhere the options are:\n");
+=09=09fprintf(stderr, "\t-s : salvo - One shot per ship in play\n");
+=09=09fprintf(stderr, "\t-b : blitz - Fire until you miss\n");
+=09=09fprintf(stderr, "\t-c : closepack - Ships may be adjacent\n");
+=09=09fprintf(stderr, "Blitz and Salvo are mutually exclusive\n");
=09=09exit(1);
-=09=09break;
-=09 case '-':
-=09=09switch(op[i][1])
-=09=09{
-=09=09case 'b':
-=09=09 blitz =3D 1;
-=09=09 if (salvo =3D=3D 1)
-=09=09 {
-=09=09=09(void) fprintf(stderr,
-=09=09=09=09"Bad Arg: -b and -s are mutually exclusive\n");
-=09=09=09exit(1);
-=09=09 }
-=09=09 break;
-=09=09case 's':
-=09=09 salvo =3D 1;
-=09=09 if (blitz =3D=3D 1)
-=09=09 {
-=09=09=09(void) fprintf(stderr,
-=09=09=09=09"Bad Arg: -s and -b are mutually exclusive\n");
-=09=09=09exit(1);
-=09=09 }
-=09=09 break;
-=09=09case 'c':
-=09=09 closepack =3D 1;
-=09=09 break;
-=09=09default:
-=09=09 (void) fprintf(stderr,
-=09=09=09 "Bad arg: type \"%s ?\" for usage message\n", op[0]);
-=09=09 exit(1);
-=09=09}
-=09 }
-=09}
- }
}
=20
-static int scount(who)
-int who;
-{
+static int scount(int who) {
int i, shots;
ship_t *sp;
=20
@@ -1187,61 +1097,65 @@
return(shots);
}
=20
-int
-main(argc, argv)
-int argc;
-char *argv[];
-{
+int main(int argc, char **argv) {
+=09int ch;
+
/* revoke */
setgid(getgid());
=20
- do_options(argc, argv);
+=09while ((ch =3D getopt(argc, argv, "bsc")) !=3D -1) {
+=09=09switch (ch) {
+=09=09=09case 'b':
+=09=09=09=09blitz =3D 1;
+=09=09=09=09break;
+=09=09=09case 's':
+=09=09=09=09salvo =3D 1;
+=09=09=09=09break;
+=09=09=09case 'c':
+=09=09=09=09closepack =3D 1;
+=09=09=09=09break;
+=09=09=09case '?':
+=09=09=09default:
+=09=09=09=09usage();
+=09=09}
+=09}
+=09argc -=3D optind;
+=09argv +=3D optind;
+=09
+=09if (blitz && salvo)
+=09=09usage();
=20
intro();
- do {
-=09initgame();
-=09while(awinna() =3D=3D -1)
-=09{
-=09 if (!blitz)
-=09 {
-=09=09if (!salvo)
-=09=09{
-=09 =09 if(turn)
-=09=09=09(void) cputurn();
-=09=09 else
-=09=09=09(void) plyturn();
-=09=09}
-=09=09else
-=09=09{
-=09=09 int i;
=20
-=09=09 i =3D scount(turn);
-=09=09 while (i--)
-=09=09 {
-=09=09=09if (turn)
-=09=09=09{
-=09=09=09 if (cputurn() && awinna() !=3D -1)
-=09=09=09=09i =3D 0;
-=09=09=09}
-=09=09=09else
-=09=09=09{
-=09=09=09 if (plyturn() && awinna() !=3D -1)
-=09=09=09=09i =3D 0;
+=09do {
+=09=09initgame();
+=09=09while(awinna() =3D=3D -1) {
+=09=09=09if (blitz) {
+=09=09=09=09while(turn ? cputurn() : plyturn())
+=09=09=09=09=09continue;
+=09=09=09} else if (salvo) {
+=09=09=09=09int i;
+=09=09
+=09=09 =09=09i =3D scount(turn);
+=09=09 =09=09while (i--) {
+=09=09=09=09=09if (turn) {
+=09=09 =09=09=09=09if (cputurn() && awinna() !=3D -1)
+=09=09=09=09=09=09i =3D 0;
+=09=09=09=09=09} else {
+=09=09 =09=09=09=09if (plyturn() && awinna() !=3D -1)
+=09=09=09=09=09=09i =3D 0;
+=09=09=09=09=09}
+=09=09 =09=09}
+=09=09=09} else {=09/* Normal game */
+=09=09=09=09if(turn)
+=09=09=09=09=09cputurn();
+=09=09 =09=09else
+=09=09=09=09=09plyturn();
=09=09=09}
-=09=09 }
+=09 =09=09turn =3D OTHER;
=09=09}
-=09 }
-=09 else
-=09 =09while(turn ? cputurn() : plyturn())
-=09=09 continue;
-=09 turn =3D OTHER;
-=09}
- } while
-=09(playagain());
+=09} while (playagain());
+
uninitgame();
- /*NOTREACHED*/
exit(0);
- /*NOTREACHED*/
}
-
-/* bs.c ends here */
------=_Part_646_23523587.1110899991863
Content-Type: text/plain; name="grdc-warns6.patch.txt"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment; filename="grdc-warns6.patch.txt"
Index: games/grdc/Makefile
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/dcvs/src/games/grdc/Makefile,v
retrieving revision 1.2
diff -u -r1.2 Makefile
--- games/grdc/Makefile=0917 Jun 2003 04:25:24 -0000=091.2
+++ games/grdc/Makefile=0915 Mar 2005 15:04:05 -0000
@@ -2,7 +2,7 @@
# $DragonFly: src/games/grdc/Makefile,v 1.2 2003/06/17 04:25:24 dillon Exp=
$
=20
PROG=3D grdc
-WARNS?=3D=092
+WARNS?=3D=096
MAN=3D grdc.6
DPADD=3D ${LIBNCURSES}
LDADD=3D -lncurses
Index: games/grdc/grdc.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/dcvs/src/games/grdc/grdc.c,v
retrieving revision 1.4
diff -u -r1.4 grdc.c
--- games/grdc/grdc.c=0925 Mar 2004 23:55:13 -0000=091.4
+++ games/grdc/grdc.c=0915 Mar 2005 15:03:54 -0000
@@ -56,7 +56,7 @@
main(int argc, char **argv)
{
=09int i, s, k;
-=09int n;
+=09int n =3D 0;
=09int ch;
=09int scrol;
=09int forever =3D 1;
------=_Part_646_23523587.1110899991863
Content-Type: text/plain; name="worm-warns6.patch.txt"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment; filename="worm-warns6.patch.txt"
Index: games/worm/worm.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/dcvs/src/games/worm/worm.c,v
retrieving revision 1.3
diff -u -r1.3 worm.c
--- games/worm/worm.c=0912 Nov 2003 14:53:54 -0000=091.3
+++ games/worm/worm.c=0915 Mar 2005 15:00:30 -0000
@@ -88,11 +88,7 @@
void suspend (int);
void wake (int);
=20
-int
-main(argc, argv)
-=09int argc;
-=09char **argv;
-{
+int main(int argc, char **argv) {
=09char ch;
=20
=09/* revoke */
@@ -174,26 +170,18 @@
=09waddch(tv, chr);
}
=20
-void
-leave(sig)
-int sig;
-{
+void leave(__unused int sig) {
=09endwin();
=09exit(0);
}
=20
-void
-wake(sig)
-int sig;
-{
+void wake(__unused int sig) {
=09signal(SIGALRM, wake);
=09fflush(stdout);
=09process(lastch);
}
=20
-long
-rnd(range)
-{
+long rnd(int range) {
=09return random() % range;
}
=20
@@ -283,9 +271,7 @@
=09=09alarm(1);
}
=20
-void
-crash()
-{
+void crash(void) {
=09sleep(2);
=09clear();
=09move(23, 0);
@@ -295,10 +281,7 @@
=09leave(0);
}
=20
-void
-suspend(sig)
-int sig;
-{
+void suspend(__unused int sig) {
=09move(LINES-1, 0);
=09refresh();
=09endwin();
@@ -310,9 +293,7 @@
=09setup();
}
=20
-void
-setup()
-{
+void setup(void) {
=09clear();
=09refresh();
=09touchwin(stw);
------=_Part_646_23523587.1110899991863
Content-Type: text/plain; name="worms-warns6.patch.txt"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment; filename="worms-warns6.patch.txt"
Index: games/worms/Makefile
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/dcvs/src/games/worms/Makefile,v
retrieving revision 1.2
diff -u -r1.2 Makefile
--- games/worms/Makefile=0917 Jun 2003 04:25:25 -0000=091.2
+++ games/worms/Makefile=0915 Mar 2005 14:58:26 -0000
@@ -6,5 +6,6 @@
MAN=3D=09worms.6
DPADD=3D=09${LIBCURSES} ${LIBTERMCAP}
LDADD=3D=09-lcurses -ltermcap
+WARNS?=3D=096
=20
.include <bsd.prog.mk>
Index: games/worms/worms.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/dcvs/src/games/worms/worms.c,v
retrieving revision 1.3
diff -u -r1.3 worms.c
--- games/worms/worms.c=0912 Nov 2003 14:53:54 -0000=091.3
+++ games/worms/worms.c=0915 Mar 2005 14:58:14 -0000
@@ -173,11 +173,7 @@
void=09 onsig (int);
void=09nomem(void);
=20
-int
-main(argc, argv)
-=09int argc;
-=09char *argv[];
-{
+int main(int argc, char **argv) {
=09int x, y, h, n;
=09struct worm *w;
=09const struct options *op;
@@ -324,10 +320,7 @@
=09}
}
=20
-void
-onsig(signo)
-=09int signo;
-{
+void onsig(__unused int signo) {
=09sig_caught =3D 1;
}
------=_Part_646_23523587.1110899991863
Content-Type: text/plain; name="wump-warns6.patch.txt"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment; filename="wump-warns6.patch.txt"
=20
Index: games/wump/Makefile
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/dcvs/src/games/wump/Makefile,v
retrieving revision 1.2
diff -u -r1.2 Makefile
--- games/wump/Makefile=0917 Jun 2003 04:25:25 -0000=091.2
+++ games/wump/Makefile=0915 Mar 2005 14:57:22 -0000
@@ -6,5 +6,6 @@
FILES=3D=09wump.info
MAN=3D=09wump.6
HIDEGAME=3Dhidegame
+WARNS?=3D=096
=20
.include <bsd.prog.mk>
Index: games/wump/wump.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/dcvs/src/games/wump/wump.c,v
retrieving revision 1.3
diff -u -r1.3 wump.c
--- games/wump/wump.c=0912 Nov 2003 14:53:54 -0000=091.3
+++ games/wump/wump.c=0915 Mar 2005 14:57:10 -0000
@@ -127,11 +127,7 @@
void =09wump_kill(void);
int =09wump_nearby(void);
=20
-int
-main(argc, argv)
-=09int argc;
-=09char **argv;
-{
+int main(int argc, char **argv) {
=09int c;
=20
=09/* revoke */
------=_Part_646_23523587.1110899991863--
討論串 (同標題文章)