From df2ff83b8d06bdf49e72c595985c77d5b4ae7582 Mon Sep 17 00:00:00 2001 From: dholland Date: Wed, 12 Aug 2009 08:54:54 +0000 Subject: sprinkle static --- sail/extern.h | 4 +- sail/globals.c | 8 ++-- sail/lo_main.c | 6 +-- sail/pl_7.c | 8 ++-- sail/player.h | 3 +- trek/capture.c | 8 ++-- trek/computer.c | 6 +-- trek/dumpgame.c | 6 +-- trek/getpar.c | 6 +-- trek/help.c | 6 +-- trek/lose.c | 6 +-- trek/phaser.c | 6 +-- trek/play.c | 10 +++-- trek/shield.c | 6 +-- trek/srscan.c | 6 +-- trek/trek.h | 4 +- trek/visual.c | 6 +-- worm/worm.c | 70 ++++++++++++++++---------------- worms/worms.c | 14 +++---- wump/wump.c | 124 ++++++++++++++++++++++++++++---------------------------- 20 files changed, 158 insertions(+), 155 deletions(-) diff --git a/sail/extern.h b/sail/extern.h index 06006683..5492001a 100644 --- a/sail/extern.h +++ b/sail/extern.h @@ -1,4 +1,4 @@ -/* $NetBSD: extern.h,v 1.34 2009/03/15 03:33:56 dholland Exp $ */ +/* $NetBSD: extern.h,v 1.35 2009/08/12 09:05:08 dholland Exp $ */ /* * Copyright (c) 1983, 1993 @@ -209,7 +209,6 @@ struct shipspecs { int rig4; short pts; }; -extern struct shipspecs specs[]; extern struct scenario *cc; /* the current scenario */ extern struct ship *ls; /* &cc->ship[cc->vessels] */ @@ -343,7 +342,6 @@ void Signal(const char *, struct ship *, ...) __attribute__((__format__(__printf__,1,3))); void Msg(const char *, ...) __attribute__((__format__(__printf__,1,2))); -void prompt(const char *, struct ship *); int sgetch(const char *, struct ship *, int); void sgetstr(const char *, char *, int); void centerview(void); diff --git a/sail/globals.c b/sail/globals.c index ec0dcb1f..0f34bae1 100644 --- a/sail/globals.c +++ b/sail/globals.c @@ -1,4 +1,4 @@ -/* $NetBSD: globals.c,v 1.14 2009/03/14 19:35:13 dholland Exp $ */ +/* $NetBSD: globals.c,v 1.15 2009/08/12 09:05:08 dholland Exp $ */ /* * Copyright (c) 1983, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)globals.c 8.2 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: globals.c,v 1.14 2009/03/14 19:35:13 dholland Exp $"); +__RCSID("$NetBSD: globals.c,v 1.15 2009/08/12 09:05:08 dholland Exp $"); #endif #endif /* not lint */ @@ -42,6 +42,8 @@ __RCSID("$NetBSD: globals.c,v 1.14 2009/03/14 19:35:13 dholland Exp $"); #include #include "extern.h" +static struct shipspecs specs[]; + struct scenario scene[] = { /* * int winddir; @@ -313,7 +315,7 @@ struct scenario scene[] = { }; int nscene = sizeof scene / sizeof (struct scenario); -struct shipspecs specs[] = { +static struct shipspecs specs[] = { /* bs fs ta guns hull crew1 crew3 gunR carR rig2 rig4 pts */ /* class qual crew2 gunL carL rig1 rig3 */ /*00*/{ 4, 7, 3, 19, 5, 5, 4, 2, 2, 2, 2, 2, 0, 0, 4, 4, 4, 4, 7 }, diff --git a/sail/lo_main.c b/sail/lo_main.c index b4902990..51954b92 100644 --- a/sail/lo_main.c +++ b/sail/lo_main.c @@ -1,4 +1,4 @@ -/* $NetBSD: lo_main.c,v 1.16 2009/03/14 20:14:56 dholland Exp $ */ +/* $NetBSD: lo_main.c,v 1.17 2009/08/12 09:05:08 dholland Exp $ */ /* * Copyright (c) 1983, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)lo_main.c 8.2 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: lo_main.c,v 1.16 2009/03/14 20:14:56 dholland Exp $"); +__RCSID("$NetBSD: lo_main.c,v 1.17 2009/08/12 09:05:08 dholland Exp $"); #endif #endif /* not lint */ @@ -51,7 +51,7 @@ __RCSID("$NetBSD: lo_main.c,v 1.16 2009/03/14 20:14:56 dholland Exp $"); #include "extern.h" #include "pathnames.h" -const char *const title[] = { +static const char *const title[] = { "Admiral", "Commodore", "Captain", "Captain", "Captain", "Captain", "Captain", "Commander", "Commander", "Lieutenant" diff --git a/sail/pl_7.c b/sail/pl_7.c index 001d4b09..7cefcaf5 100644 --- a/sail/pl_7.c +++ b/sail/pl_7.c @@ -1,4 +1,4 @@ -/* $NetBSD: pl_7.c,v 1.37 2009/03/15 22:19:23 dholland Exp $ */ +/* $NetBSD: pl_7.c,v 1.38 2009/08/12 09:05:08 dholland Exp $ */ /* * Copyright (c) 1983, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)pl_7.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: pl_7.c,v 1.37 2009/03/15 22:19:23 dholland Exp $"); +__RCSID("$NetBSD: pl_7.c,v 1.38 2009/08/12 09:05:08 dholland Exp $"); #endif #endif /* not lint */ @@ -86,7 +86,7 @@ static bool dbp[3]; int done_curses; int loaded, fired, changed, repaired; int dont_adjust; -int viewrow, viewcol; +static int viewrow, viewcol; char movebuf[sizeof SHIP(0)->file->movebuf]; int player; struct ship *ms; /* memorial structure, &cc->ship[player] */ @@ -291,7 +291,7 @@ Msg(const char *fmt, ...) scrollarea_add(buf); } -void +static void prompt(const char *p, struct ship *ship) { static char buf[BUFSIZ]; diff --git a/sail/player.h b/sail/player.h index 6f6c9db2..cb555a05 100644 --- a/sail/player.h +++ b/sail/player.h @@ -1,4 +1,4 @@ -/* $NetBSD: player.h,v 1.12 2009/03/14 20:10:43 dholland Exp $ */ +/* $NetBSD: player.h,v 1.13 2009/08/12 09:05:08 dholland Exp $ */ /* * Copyright (c) 1983, 1993 @@ -88,7 +88,6 @@ extern int done_curses; extern int loaded, fired, changed, repaired; extern int dont_adjust; -extern int viewrow, viewcol; extern char movebuf[sizeof SHIP(0)->file->movebuf]; extern const char version[]; extern int player; diff --git a/trek/capture.c b/trek/capture.c index bc3d0932..48a70e81 100644 --- a/trek/capture.c +++ b/trek/capture.c @@ -1,4 +1,4 @@ -/* $NetBSD: capture.c,v 1.11 2009/05/24 22:55:03 dholland Exp $ */ +/* $NetBSD: capture.c,v 1.12 2009/08/12 08:54:54 dholland Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,13 +34,15 @@ #if 0 static char sccsid[] = "@(#)capture.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: capture.c,v 1.11 2009/05/24 22:55:03 dholland Exp $"); +__RCSID("$NetBSD: capture.c,v 1.12 2009/08/12 08:54:54 dholland Exp $"); #endif #endif /* not lint */ #include #include "trek.h" +static struct kling *selectklingon(void); + /* ** Ask a Klingon To Surrender ** @@ -121,7 +123,7 @@ capture(int v __unused) ** Cruddy, just takes one at random. Should ask the captain. */ -struct kling * +static struct kling * selectklingon(void) { int i; diff --git a/trek/computer.c b/trek/computer.c index c3c507d4..2b3e0522 100644 --- a/trek/computer.c +++ b/trek/computer.c @@ -1,4 +1,4 @@ -/* $NetBSD: computer.c,v 1.15 2009/05/24 23:20:22 dholland Exp $ */ +/* $NetBSD: computer.c,v 1.16 2009/08/12 08:54:54 dholland Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)computer.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: computer.c,v 1.15 2009/05/24 23:20:22 dholland Exp $"); +__RCSID("$NetBSD: computer.c,v 1.16 2009/08/12 08:54:54 dholland Exp $"); #endif #endif /* not lint */ @@ -90,7 +90,7 @@ __RCSID("$NetBSD: computer.c,v 1.15 2009/05/24 23:20:22 dholland Exp $"); ** command processor. */ -struct cvntab Cputab[] = { +static struct cvntab Cputab[] = { { "ch", "art", (cmdfun)1, 0 }, { "t", "rajectory", (cmdfun)2, 0 }, { "c", "ourse", (cmdfun)3, 0 }, diff --git a/trek/dumpgame.c b/trek/dumpgame.c index 0c98662d..d3926813 100644 --- a/trek/dumpgame.c +++ b/trek/dumpgame.c @@ -1,4 +1,4 @@ -/* $NetBSD: dumpgame.c,v 1.14 2009/05/24 21:44:56 dholland Exp $ */ +/* $NetBSD: dumpgame.c,v 1.15 2009/08/12 08:54:54 dholland Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)dumpgame.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: dumpgame.c,v 1.14 2009/05/24 21:44:56 dholland Exp $"); +__RCSID("$NetBSD: dumpgame.c,v 1.15 2009/08/12 08:54:54 dholland Exp $"); #endif #endif /* not lint */ @@ -55,7 +55,7 @@ struct dump { static int readdump(int); -struct dump Dump_template[] = { +static struct dump Dump_template[] = { { (char *)&Ship, sizeof (Ship) }, { (char *)&Now, sizeof (Now) }, { (char *)&Param, sizeof (Param) }, diff --git a/trek/getpar.c b/trek/getpar.c index be3f180b..4a271d32 100644 --- a/trek/getpar.c +++ b/trek/getpar.c @@ -1,4 +1,4 @@ -/* $NetBSD: getpar.c,v 1.17 2009/05/25 00:43:34 dholland Exp $ */ +/* $NetBSD: getpar.c,v 1.18 2009/08/12 08:54:54 dholland Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)getpar.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: getpar.c,v 1.17 2009/05/25 00:43:34 dholland Exp $"); +__RCSID("$NetBSD: getpar.c,v 1.18 2009/08/12 08:54:54 dholland Exp $"); #endif #endif /* not lint */ @@ -96,7 +96,7 @@ getfltpar(const char *s) ** get yes/no parameter **/ -const struct cvntab Yntab[] = { +static const struct cvntab Yntab[] = { { "y", "es", (cmdfun)1, 1 }, { "n", "o", (cmdfun)0, 0 }, { NULL, NULL, NULL, 0 } diff --git a/trek/help.c b/trek/help.c index 021a30ee..16b4716a 100644 --- a/trek/help.c +++ b/trek/help.c @@ -1,4 +1,4 @@ -/* $NetBSD: help.c,v 1.12 2009/05/24 22:55:03 dholland Exp $ */ +/* $NetBSD: help.c,v 1.13 2009/08/12 08:54:54 dholland Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)help.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: help.c,v 1.12 2009/05/24 22:55:03 dholland Exp $"); +__RCSID("$NetBSD: help.c,v 1.13 2009/08/12 08:54:54 dholland Exp $"); #endif #endif /* not lint */ @@ -64,7 +64,7 @@ __RCSID("$NetBSD: help.c,v 1.12 2009/05/24 22:55:03 dholland Exp $"); ** to drop you. After that, it's your problem. */ -const char *const Cntvect[3] = { +static const char *const Cntvect[3] = { "first", "second", "third" }; diff --git a/trek/lose.c b/trek/lose.c index 974b1776..957712f5 100644 --- a/trek/lose.c +++ b/trek/lose.c @@ -1,4 +1,4 @@ -/* $NetBSD: lose.c,v 1.9 2009/05/24 21:44:56 dholland Exp $ */ +/* $NetBSD: lose.c,v 1.10 2009/08/12 08:54:54 dholland Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)lose.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: lose.c,v 1.9 2009/05/24 21:44:56 dholland Exp $"); +__RCSID("$NetBSD: lose.c,v 1.10 2009/08/12 08:54:54 dholland Exp $"); #endif #endif /* not lint */ @@ -54,7 +54,7 @@ __RCSID("$NetBSD: lose.c,v 1.9 2009/05/24 21:44:56 dholland Exp $"); extern jmp_buf env; -const char *const Losemsg[] = { +static const char *const Losemsg[] = { "You ran out of time", "You ran out of energy", "You have been destroyed", diff --git a/trek/phaser.c b/trek/phaser.c index cb2c0791..6328ee5a 100644 --- a/trek/phaser.c +++ b/trek/phaser.c @@ -1,4 +1,4 @@ -/* $NetBSD: phaser.c,v 1.14 2009/05/24 22:55:03 dholland Exp $ */ +/* $NetBSD: phaser.c,v 1.15 2009/08/12 08:54:54 dholland Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)phaser.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: phaser.c,v 1.14 2009/05/24 22:55:03 dholland Exp $"); +__RCSID("$NetBSD: phaser.c,v 1.15 2009/08/12 08:54:54 dholland Exp $"); #endif #endif /* not lint */ @@ -76,7 +76,7 @@ __RCSID("$NetBSD: phaser.c,v 1.14 2009/05/24 22:55:03 dholland Exp $"); ** Uses trace flag 30 */ -struct cvntab Matab[] = { +static struct cvntab Matab[] = { { "m", "anual", (cmdfun) 1, 0 }, { "a", "utomatic", (cmdfun) 0, 0 }, { NULL, NULL, NULL, 0 } diff --git a/trek/play.c b/trek/play.c index 9d8e6347..85649330 100644 --- a/trek/play.c +++ b/trek/play.c @@ -1,4 +1,4 @@ -/* $NetBSD: play.c,v 1.11 2009/05/24 21:44:56 dholland Exp $ */ +/* $NetBSD: play.c,v 1.12 2009/08/12 08:54:54 dholland Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)play.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: play.c,v 1.11 2009/05/24 21:44:56 dholland Exp $"); +__RCSID("$NetBSD: play.c,v 1.12 2009/08/12 08:54:54 dholland Exp $"); #endif #endif /* not lint */ @@ -43,6 +43,8 @@ __RCSID("$NetBSD: play.c,v 1.11 2009/05/24 21:44:56 dholland Exp $"); #include "trek.h" #include "getpar.h" +static void myreset(int) __dead; + /* ** INSTRUCTION READ AND MAIN PLAY LOOP ** @@ -56,7 +58,7 @@ __RCSID("$NetBSD: play.c,v 1.11 2009/05/24 21:44:56 dholland Exp $"); extern jmp_buf env; -const struct cvntab Comtab[] = { +static const struct cvntab Comtab[] = { { "abandon", "", abandon, 0 }, { "ca", "pture", capture, 0 }, { "cl", "oak", shield, -1 }, @@ -84,7 +86,7 @@ const struct cvntab Comtab[] = { }; /*ARGSUSED*/ -void +static void myreset(int v __unused) { diff --git a/trek/shield.c b/trek/shield.c index bcc31d2e..a14c22a7 100644 --- a/trek/shield.c +++ b/trek/shield.c @@ -1,4 +1,4 @@ -/* $NetBSD: shield.c,v 1.12 2009/05/25 00:43:34 dholland Exp $ */ +/* $NetBSD: shield.c,v 1.13 2009/08/12 08:54:54 dholland Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)shield.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: shield.c,v 1.12 2009/05/25 00:43:34 dholland Exp $"); +__RCSID("$NetBSD: shield.c,v 1.13 2009/08/12 08:54:54 dholland Exp $"); #endif #endif /* not lint */ @@ -59,7 +59,7 @@ __RCSID("$NetBSD: shield.c,v 1.12 2009/05/25 00:43:34 dholland Exp $"); ** so you get partial hits. */ -const struct cvntab Udtab[] = { +static const struct cvntab Udtab[] = { { "u", "p", (cmdfun)1, 0 }, { "d", "own", (cmdfun)0, 0 }, { NULL, NULL, NULL, 0 } diff --git a/trek/srscan.c b/trek/srscan.c index 4c8c1c3c..64c6d290 100644 --- a/trek/srscan.c +++ b/trek/srscan.c @@ -1,4 +1,4 @@ -/* $NetBSD: srscan.c,v 1.10 2009/05/25 00:39:45 dholland Exp $ */ +/* $NetBSD: srscan.c,v 1.11 2009/08/12 08:54:54 dholland Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)srscan.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: srscan.c,v 1.10 2009/05/25 00:39:45 dholland Exp $"); +__RCSID("$NetBSD: srscan.c,v 1.11 2009/08/12 08:54:54 dholland Exp $"); #endif #endif /* not lint */ @@ -57,7 +57,7 @@ __RCSID("$NetBSD: srscan.c,v 1.10 2009/05/25 00:39:45 dholland Exp $"); ** The current quadrant is filled in on the computer chart. */ -const char *const Color[4] = { +static const char *const Color[4] = { "GREEN", "DOCKED", "YELLOW", diff --git a/trek/trek.h b/trek/trek.h index b92c8b6d..99c61e48 100644 --- a/trek/trek.h +++ b/trek/trek.h @@ -1,4 +1,4 @@ -/* $NetBSD: trek.h,v 1.17 2009/05/25 00:07:14 dholland Exp $ */ +/* $NetBSD: trek.h,v 1.18 2009/08/12 08:54:54 dholland Exp $ */ /* * Copyright (c) 1980, 1993 @@ -379,7 +379,6 @@ void autover(void); /* capture.c */ void capture(int); -struct kling *selectklingon(void); /* check_out.c */ int check_out(int); @@ -465,7 +464,6 @@ void out(int); void phaser(int); /* play.c */ -void myreset(int) __dead; void play(void) __dead; /* ram.c */ diff --git a/trek/visual.c b/trek/visual.c index b0b2bb3e..286901e2 100644 --- a/trek/visual.c +++ b/trek/visual.c @@ -1,4 +1,4 @@ -/* $NetBSD: visual.c,v 1.9 2009/05/24 21:44:56 dholland Exp $ */ +/* $NetBSD: visual.c,v 1.10 2009/08/12 08:54:54 dholland Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)visual.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: visual.c,v 1.9 2009/05/24 21:44:56 dholland Exp $"); +__RCSID("$NetBSD: visual.c,v 1.10 2009/08/12 08:54:54 dholland Exp $"); #endif #endif /* not lint */ @@ -52,7 +52,7 @@ __RCSID("$NetBSD: visual.c,v 1.9 2009/05/24 21:44:56 dholland Exp $"); */ /* This struct[] has the delta x, delta y for particular directions */ -struct xy Visdelta[11] = { +static struct xy Visdelta[11] = { { -1, -1 }, { -1, 0 }, { -1, 1 }, diff --git a/worm/worm.c b/worm/worm.c index 2c166128..235ea1cf 100644 --- a/worm/worm.c +++ b/worm/worm.c @@ -1,4 +1,4 @@ -/* $NetBSD: worm.c,v 1.28 2008/08/08 16:10:47 drochner Exp $ */ +/* $NetBSD: worm.c,v 1.29 2009/08/12 08:56:41 dholland Exp $ */ /* * Copyright (c) 1980, 1993 @@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1993\ #if 0 static char sccsid[] = "@(#)worm.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: worm.c,v 1.28 2008/08/08 16:10:47 drochner Exp $"); +__RCSID("$NetBSD: worm.c,v 1.29 2009/08/12 08:56:41 dholland Exp $"); #endif #endif /* not lint */ @@ -63,34 +63,36 @@ __RCSID("$NetBSD: worm.c,v 1.28 2008/08/08 16:10:47 drochner Exp $"); #define RUNLEN 8 #define CNTRL(p) (p-'A'+1) -WINDOW *tv; -WINDOW *stw; struct body { int x; int y; struct body *prev; struct body *next; -} *head, *tail, goody; -int growing = 0; -int running = 0; -int slow = 0; -int score = 0; -int start_len = LENGTH; -int visible_len; -int lastch; -char outbuf[BUFSIZ]; - -void crash(void) __dead; -void display(const struct body *, char); +}; + +static WINDOW *tv; +static WINDOW *stw; +static struct body *head, *tail, goody; +static int growing = 0; +static int running = 0; +static int slow = 0; +static int score = 0; +static int start_len = LENGTH; +static int visible_len; +static int lastch; +static char outbuf[BUFSIZ]; + int main(int, char **); -void leave(int) __dead; -void life(void); -void newpos(struct body *); -void process(int); -void prize(void); -int rnd(int); -void setup(void); -void wake(int); +static void crash(void) __dead; +static void display(const struct body *, char); +static void leave(int) __dead; +static void life(void); +static void newpos(struct body *); +static void process(int); +static void prize(void); +static int rnd(int); +static void setup(void); +static void wake(int); int main(argc, argv) @@ -155,7 +157,7 @@ main(argc, argv) } } -void +static void life() { struct body *bp, *np; @@ -190,7 +192,7 @@ life() visible_len = start_len + 1; } -void +static void display(pos, chr) const struct body *pos; char chr; @@ -199,7 +201,7 @@ display(pos, chr) waddch(tv, chr); } -void +static void leave(dummy) int dummy; { @@ -212,7 +214,7 @@ leave(dummy) exit(0); } -void +static void wake(dummy) int dummy __unused; { @@ -221,14 +223,14 @@ wake(dummy) process(lastch); } -int +static int rnd(range) int range; { return abs((rand()>>5)+(rand()>>5)) % range; } -void +static void newpos(bp) struct body * bp; { @@ -246,7 +248,7 @@ newpos(bp) } while(winch(tv) != ' '); } -void +static void prize() { int value; @@ -257,7 +259,7 @@ prize() wrefresh(tv); } -void +static void process(ch) int ch; { @@ -352,13 +354,13 @@ process(ch) alarm(1); } -void +static void crash() { leave(0); } -void +static void setup() { clear(); diff --git a/worms/worms.c b/worms/worms.c index f5a600dd..ebdf290e 100644 --- a/worms/worms.c +++ b/worms/worms.c @@ -1,4 +1,4 @@ -/* $NetBSD: worms.c,v 1.19 2008/08/08 16:10:47 drochner Exp $ */ +/* $NetBSD: worms.c,v 1.20 2009/08/12 08:57:30 dholland Exp $ */ /* * Copyright (c) 1980, 1993 @@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1993\ #if 0 static char sccsid[] = "@(#)worms.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: worms.c,v 1.19 2008/08/08 16:10:47 drochner Exp $"); +__RCSID("$NetBSD: worms.c,v 1.20 2009/08/12 08:57:30 dholland Exp $"); #endif #endif /* not lint */ @@ -177,11 +177,11 @@ static struct worm { short *xpos, *ypos; } *worm; -volatile sig_atomic_t sig_caught = 0; +static volatile sig_atomic_t sig_caught = 0; int main(int, char **); -void nomem(void) __dead; -void onsig(int); +static void nomem(void) __dead; +static void onsig(int); int main(argc, argv) @@ -339,14 +339,14 @@ main(argc, argv) } } -void +static void onsig(signo) int signo __unused; { sig_caught = 1; } -void +static void nomem() { errx(1, "not enough memory."); diff --git a/wump/wump.c b/wump/wump.c index ed4e67fa..dcc65fc3 100644 --- a/wump/wump.c +++ b/wump/wump.c @@ -1,4 +1,4 @@ -/* $NetBSD: wump.c,v 1.23 2008/07/20 01:03:22 lukem Exp $ */ +/* $NetBSD: wump.c,v 1.24 2009/08/12 09:00:10 dholland Exp $ */ /* * Copyright (c) 1989, 1993 @@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 1993\ #if 0 static char sccsid[] = "@(#)wump.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: wump.c,v 1.23 2008/07/20 01:03:22 lukem Exp $"); +__RCSID("$NetBSD: wump.c,v 1.24 2009/08/12 09:00:10 dholland Exp $"); #endif #endif /* not lint */ @@ -86,7 +86,7 @@ __RCSID("$NetBSD: wump.c,v 1.23 2008/07/20 01:03:22 lukem Exp $"); #define plural(n) (n == 1 ? "" : "s") /* simple cave data structure; +1 so we can index from '1' not '0' */ -struct room_record { +static struct room_record { int tunnel[MAX_LINKS_IN_ROOM]; int has_a_pit, has_a_bat; } cave[MAX_ROOMS_IN_CAVE+1]; @@ -95,47 +95,47 @@ struct room_record { * global variables so we can keep track of where the player is, how * many arrows they still have, where el wumpo is, and so on... */ -int player_loc = -1; /* player location */ -int wumpus_loc = -1; /* The Bad Guy location */ -int level = EASY; /* level of play */ -int arrows_left; /* arrows unshot */ +static int player_loc = -1; /* player location */ +static int wumpus_loc = -1; /* The Bad Guy location */ +static int level = EASY; /* level of play */ +static int arrows_left; /* arrows unshot */ #ifdef DEBUG -int debug = 0; +static int debug = 0; #endif -int pit_num = PIT_COUNT; /* # pits in cave */ -int bat_num = BAT_COUNT; /* # bats */ -int room_num = ROOMS_IN_CAVE; /* # rooms in cave */ -int link_num = LINKS_IN_ROOM; /* links per room */ -int arrow_num = NUMBER_OF_ARROWS; /* arrow inventory */ - -char answer[20]; /* user input */ - -int bats_nearby(void); -void cave_init(void); -void clear_things_in_cave(void); -void display_room_stats(void); -int gcd(int, int); -int getans(const char *); -void initialize_things_in_cave(void); -void instructions(void); -int int_compare(const void *, const void *); -void jump(int); -void kill_wump(void); +static int pit_num = PIT_COUNT; /* # pits in cave */ +static int bat_num = BAT_COUNT; /* # bats */ +static int room_num = ROOMS_IN_CAVE; /* # rooms in cave */ +static int link_num = LINKS_IN_ROOM; /* links per room */ +static int arrow_num = NUMBER_OF_ARROWS;/* arrow inventory */ + +static char answer[20]; /* user input */ + int main(int, char **); -int move_to(const char *); -void move_wump(void); -void no_arrows(void); -void pit_kill(void); -int pit_nearby(void); -void pit_survive(void); -int shoot(char *); -void shoot_self(void); -int take_action(void); -void usage(void) __dead; -void wump_kill(void); -int wump_nearby(void); +static int bats_nearby(void); +static void cave_init(void); +static void clear_things_in_cave(void); +static void display_room_stats(void); +static int gcd(int, int); +static int getans(const char *); +static void initialize_things_in_cave(void); +static void instructions(void); +static int int_compare(const void *, const void *); +static void jump(int); +static void kill_wump(void); +static int move_to(const char *); +static void move_wump(void); +static void no_arrows(void); +static void pit_kill(void); +static int pit_nearby(void); +static void pit_survive(void); +static int shoot(char *); +static void shoot_self(void); +static int take_action(void); +static void usage(void) __dead; +static void wump_kill(void); +static int wump_nearby(void); int main(argc, argv) @@ -254,7 +254,7 @@ quiver holds %d custom super anti-evil Wumpus arrows. Good luck.\n", return (0); } -void +static void display_room_stats() { int i; @@ -284,7 +284,7 @@ display_room_stats() (void)printf("and %d.\n", cave[player_loc].tunnel[link_num - 1]); } -int +static int take_action() { /* @@ -313,7 +313,7 @@ take_action() return(0); } -int +static int move_to(room_number) const char *room_number; { @@ -405,7 +405,7 @@ move_to(room_number) return(0); } -int +static int shoot(room_list) char *room_list; { @@ -518,7 +518,7 @@ The arrow is weakly shot and can go no further!\n"); return(0); } -int +static int gcd(a, b) int a, b; { @@ -530,7 +530,7 @@ gcd(a, b) return (gcd(b, r)); } -void +static void cave_init() { int i, j, k, lnk; @@ -610,7 +610,7 @@ try_again: lnk = (random() % room_num) + 1; #endif } -void +static void clear_things_in_cave() { int i; @@ -623,7 +623,7 @@ clear_things_in_cave() cave[i].has_a_bat = cave[i].has_a_pit = 0; } -void +static void initialize_things_in_cave() { int i, loc; @@ -667,7 +667,7 @@ initialize_things_in_cave() (i > 100 && player_loc != wumpus_loc)); } -int +static int getans(prompt) const char *prompt; { @@ -693,7 +693,7 @@ getans(prompt) /* NOTREACHED */ } -int +static int bats_nearby() { int i; @@ -705,7 +705,7 @@ bats_nearby() return(0); } -int +static int pit_nearby() { int i; @@ -717,7 +717,7 @@ pit_nearby() return(0); } -int +static int wump_nearby() { int i, j; @@ -734,20 +734,20 @@ wump_nearby() return(0); } -void +static void move_wump() { wumpus_loc = cave[wumpus_loc].tunnel[random() % link_num]; } -int +static int int_compare(a, b) const void *a, *b; { return(*(const int *)a < *(const int *)b ? -1 : 1); } -void +static void instructions() { const char *pager; @@ -791,7 +791,7 @@ puff of greasy black smoke! (poof)\n"); } } -void +static void usage() { (void)fprintf(stderr, @@ -801,7 +801,7 @@ usage() /* messages */ -void +static void wump_kill() { (void)printf( @@ -813,7 +813,7 @@ so long since the evil Wumpus cleaned his teeth that you immediately\n\ passed out from the stench!\n"); } -void +static void kill_wump() { (void)printf( @@ -825,7 +825,7 @@ dead Wumpus is also quite well known, a stench plenty enough to slay the\n\ mightiest adventurer at a single whiff!!\n"); } -void +static void no_arrows() { (void)printf( @@ -835,7 +835,7 @@ with its psychic powers, the evil Wumpus rampagees through the cave, finds\n\ you, and with a mighty *ROAR* eats you alive!\n"); } -void +static void shoot_self() { (void)printf( @@ -846,7 +846,7 @@ and immediately rushes to your side, not to help, alas, but to EAT YOU!\n\ (*CHOMP*)\n"); } -void +static void jump(where) int where; { @@ -856,7 +856,7 @@ notice that the walls are shimmering and glowing. Suddenly you feel\n\ a very curious, warm sensation and find yourself in room %d!!\n", where); } -void +static void pit_kill() { (void)printf( @@ -868,7 +868,7 @@ you fall many miles to the core of the earth. Look on the bright side;\n\ you can at least find out if Jules Verne was right...\n"); } -void +static void pit_survive() { (void)printf( -- cgit v1.2.3-56-ge451