summaryrefslogtreecommitdiffstats
path: root/hunt
diff options
context:
space:
mode:
authordholland <dholland@NetBSD.org>2009-08-12 07:42:11 +0000
committerdholland <dholland@NetBSD.org>2009-08-12 07:42:11 +0000
commitc10b9a8ce82ad7b4b287ccc5b5b576ab961aa488 (patch)
treeada5191dc0ecc9bd46bd68d6b73ea060c04570d4 /hunt
parent8b1c71ee649fb41155da92995044e451c39ea700 (diff)
downloadbsdgames-darwin-c10b9a8ce82ad7b4b287ccc5b5b576ab961aa488.tar.gz
bsdgames-darwin-c10b9a8ce82ad7b4b287ccc5b5b576ab961aa488.tar.zst
bsdgames-darwin-c10b9a8ce82ad7b4b287ccc5b5b576ab961aa488.zip
sprinkle static and prune some dead code
Diffstat (limited to 'hunt')
-rw-r--r--hunt/hunt/hunt.c69
-rw-r--r--hunt/hunt/playit.c7
-rw-r--r--hunt/huntd/answer.c14
-rw-r--r--hunt/huntd/draw.c17
-rw-r--r--hunt/huntd/driver.c22
-rw-r--r--hunt/huntd/extern.c6
-rw-r--r--hunt/huntd/hunt.h18
-rw-r--r--hunt/huntd/makemaze.c8
8 files changed, 74 insertions, 87 deletions
diff --git a/hunt/hunt/hunt.c b/hunt/hunt/hunt.c
index a31bdf47..6db20116 100644
--- a/hunt/hunt/hunt.c
+++ b/hunt/hunt/hunt.c
@@ -1,4 +1,4 @@
-/* $NetBSD: hunt.c,v 1.35 2009/07/04 07:51:34 dholland Exp $ */
+/* $NetBSD: hunt.c,v 1.36 2009/08/12 07:42:11 dholland Exp $ */
/*
* Copyright (c) 1983-2003, Regents of the University of California.
* All rights reserved.
@@ -32,7 +32,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: hunt.c,v 1.35 2009/07/04 07:51:34 dholland Exp $");
+__RCSID("$NetBSD: hunt.c,v 1.36 2009/08/12 07:42:11 dholland Exp $");
#endif /* not lint */
#include <sys/param.h>
@@ -62,16 +62,16 @@ FLAG Am_monitor = FALSE;
char Buf[BUFSIZ];
-int Socket;
+/*static*/ int Socket;
#ifdef INTERNET
-char *Sock_host;
-char *use_port;
-FLAG Query_driver = FALSE;
+static char *Sock_host;
+static char *use_port;
+static FLAG Query_driver = FALSE;
char *Send_message = NULL;
-FLAG Show_scores = FALSE;
+static FLAG Show_scores = FALSE;
#endif
-SOCKET Daemon;
+static SOCKET Daemon;
#ifdef INTERNET
#define DAEMON_SIZE (sizeof Daemon)
#else
@@ -88,15 +88,20 @@ static int in_visual;
extern int cur_row, cur_col;
-void dump_scores(SOCKET);
-long env_init(long);
-void fill_in_blanks(void);
-void leave(int, const char *) __dead;
-void leavex(int, const char *) __dead;
-void fincurs(void);
-int main(int, char *[]);
+static void dump_scores(SOCKET);
+static long env_init(long);
+static void fill_in_blanks(void);
+static void leave(int, const char *) __dead;
+static void leavex(int, const char *) __dead;
+static void fincurs(void);
+static void rmnl(char *);
+static void sigterm(int) __dead;
+static void sigusr1(int) __dead;
+static void find_driver(FLAG);
+static void start_driver(void);
+static int broadcast_vec(int, struct sockaddr **);
#ifdef INTERNET
-SOCKET *list_drivers(void);
+static SOCKET *list_drivers(void);
#endif
extern int Otto_mode;
@@ -331,7 +336,7 @@ main(int ac, char **av)
}
#ifdef INTERNET
-int
+static int
broadcast_vec(int s /*socket*/, struct sockaddr **vector)
{
int vec_cnt;
@@ -506,7 +511,7 @@ test_one_host:
goto get_response;
}
-void
+static void
find_driver(FLAG do_startup)
{
SOCKET *hosts;
@@ -556,7 +561,7 @@ find_driver(FLAG do_startup)
find_driver(FALSE);
}
-void
+static void
dump_scores(SOCKET host)
{
struct hostent *hp;
@@ -581,7 +586,7 @@ dump_scores(SOCKET host)
#endif
-void
+static void
start_driver(void)
{
int procid;
@@ -655,7 +660,7 @@ bad_ver(void)
* sigterm:
* Handle a terminate signal
*/
-void
+static void
sigterm(int dummy __unused)
{
leavex(0, NULL);
@@ -667,30 +672,18 @@ sigterm(int dummy __unused)
* sigusr1:
* Handle a usr1 signal
*/
-void
+static void
sigusr1(int dummy __unused)
{
leavex(1, "Unable to start driver. Try again.");
/* NOTREACHED */
}
-#ifdef INTERNET
-/*
- * sigalrm:
- * Handle an alarm signal
- */
-void
-sigalrm(int dummy __unused)
-{
- return;
-}
-#endif
-
/*
* rmnl:
* Remove a '\n' at the end of a string if there is one
*/
-void
+static void
rmnl(char *s)
{
char *cp;
@@ -745,7 +738,7 @@ intr(int dummy __unused)
}
}
-void
+static void
fincurs(void)
{
if (in_visual) {
@@ -781,7 +774,7 @@ leavex(int eval, const char *mesg)
errx(eval, mesg ? mesg : "");
}
-long
+static long
env_init(long enter_status)
{
int i;
@@ -890,7 +883,7 @@ env_init(long enter_status)
return enter_status;
}
-void
+static void
fill_in_blanks(void)
{
int i;
diff --git a/hunt/hunt/playit.c b/hunt/hunt/playit.c
index f7415d93..a4ef7f6d 100644
--- a/hunt/hunt/playit.c
+++ b/hunt/hunt/playit.c
@@ -1,4 +1,4 @@
-/* $NetBSD: playit.c,v 1.14 2009/07/04 07:51:34 dholland Exp $ */
+/* $NetBSD: playit.c,v 1.15 2009/08/12 07:42:11 dholland Exp $ */
/*
* Copyright (c) 1983-2003, Regents of the University of California.
* All rights reserved.
@@ -32,7 +32,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: playit.c,v 1.14 2009/07/04 07:51:34 dholland Exp $");
+__RCSID("$NetBSD: playit.c,v 1.15 2009/08/12 07:42:11 dholland Exp $");
#endif /* not lint */
#include <sys/file.h>
@@ -77,6 +77,7 @@ static unsigned char ibuf[256], *iptr = ibuf;
static unsigned char getchr(void);
static void send_stuff(void);
+static void redraw_screen(void);
/*
* playit:
@@ -415,7 +416,7 @@ clear_the_screen(void)
refresh();
}
-void
+static void
redraw_screen(void)
{
clearok(stdscr, TRUE);
diff --git a/hunt/huntd/answer.c b/hunt/huntd/answer.c
index 74f162ed..396fdba9 100644
--- a/hunt/huntd/answer.c
+++ b/hunt/huntd/answer.c
@@ -1,4 +1,4 @@
-/* $NetBSD: answer.c,v 1.14 2009/07/04 04:29:54 dholland Exp $ */
+/* $NetBSD: answer.c,v 1.15 2009/08/12 07:42:11 dholland Exp $ */
/*
* Copyright (c) 1983-2003, Regents of the University of California.
* All rights reserved.
@@ -32,7 +32,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: answer.c,v 1.14 2009/07/04 04:29:54 dholland Exp $");
+__RCSID("$NetBSD: answer.c,v 1.15 2009/08/12 07:42:11 dholland Exp $");
#endif /* not lint */
#include <ctype.h>
@@ -46,6 +46,10 @@ __RCSID("$NetBSD: answer.c,v 1.14 2009/07/04 04:29:54 dholland Exp $");
static char Ttyname[NAMELEN];
+static IDENT *get_ident(uint32_t, uint32_t, char *, char);
+static void stmonitor(PLAYER *);
+static void stplayer(PLAYER *, int);
+
int
answer(void)
{
@@ -203,7 +207,7 @@ answer(void)
}
#ifdef MONITOR
-void
+static void
stmonitor(PLAYER *pp)
{
int line;
@@ -232,7 +236,7 @@ stmonitor(PLAYER *pp)
}
#endif
-void
+static void
stplayer(PLAYER *newpp, int enter_status)
{
int x, y;
@@ -380,7 +384,7 @@ rand_dir(void)
* get_ident:
* Get the score structure of a player
*/
-IDENT *
+static IDENT *
get_ident(uint32_t machine, uint32_t uid, char *name, char team)
{
IDENT *ip;
diff --git a/hunt/huntd/draw.c b/hunt/huntd/draw.c
index df4ff1ec..f56d4748 100644
--- a/hunt/huntd/draw.c
+++ b/hunt/huntd/draw.c
@@ -1,4 +1,4 @@
-/* $NetBSD: draw.c,v 1.7 2009/07/04 04:29:54 dholland Exp $ */
+/* $NetBSD: draw.c,v 1.8 2009/08/12 07:42:11 dholland Exp $ */
/*
* Copyright (c) 1983-2003, Regents of the University of California.
* All rights reserved.
@@ -32,11 +32,16 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: draw.c,v 1.7 2009/07/04 04:29:54 dholland Exp $");
+__RCSID("$NetBSD: draw.c,v 1.8 2009/08/12 07:42:11 dholland Exp $");
#endif /* not lint */
#include "hunt.h"
+static void drawstatus(PLAYER *);
+static void see(PLAYER *, int);
+static char translate(char);
+static int player_sym(PLAYER *, int, int);
+
void
drawmaze(PLAYER *pp)
{
@@ -69,7 +74,7 @@ drawmaze(PLAYER *pp)
* drawstatus - put up the status lines (this assumes the screen
* size is 80x24 with the maze being 64x24)
*/
-void
+static void
drawstatus(PLAYER *pp)
{
int i;
@@ -169,7 +174,7 @@ look(PLAYER *pp)
cgoto(pp, y, x);
}
-void
+static void
see(PLAYER *pp, int face)
{
char *sp;
@@ -355,7 +360,7 @@ message(PLAYER *pp, const char *s)
* Turn a character into the right direction character if we are
* looking at the current player.
*/
-char
+static char
translate(char ch)
{
switch (ch) {
@@ -375,7 +380,7 @@ translate(char ch)
* player_sym:
* Return the player symbol
*/
-int
+static int
player_sym(PLAYER *pp, int y, int x)
{
PLAYER *npp;
diff --git a/hunt/huntd/driver.c b/hunt/huntd/driver.c
index 9d446d5f..0abf364a 100644
--- a/hunt/huntd/driver.c
+++ b/hunt/huntd/driver.c
@@ -1,4 +1,4 @@
-/* $NetBSD: driver.c,v 1.19 2009/07/04 06:38:35 dholland Exp $ */
+/* $NetBSD: driver.c,v 1.20 2009/08/12 07:42:11 dholland Exp $ */
/*
* Copyright (c) 1983-2003, Regents of the University of California.
* All rights reserved.
@@ -32,7 +32,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: driver.c,v 1.19 2009/07/04 06:38:35 dholland Exp $");
+__RCSID("$NetBSD: driver.c,v 1.20 2009/08/12 07:42:11 dholland Exp $");
#endif /* not lint */
#include <sys/ioctl.h>
@@ -51,19 +51,19 @@ __RCSID("$NetBSD: driver.c,v 1.19 2009/07/04 06:38:35 dholland Exp $");
#define RN ((Seed = Seed * 11109 + 13849) & 0x7fff)
#endif
-int Seed = 0;
+static int Seed = 0;
-SOCKET Daemon;
-char *First_arg; /* pointer to argv[0] */
-char *Last_arg; /* pointer to end of argv/environ */
+static SOCKET Daemon;
+static char *First_arg; /* pointer to argv[0] */
+static char *Last_arg; /* pointer to end of argv/environ */
#ifdef INTERNET
-int Test_socket; /* test socket to answer datagrams */
-FLAG inetd_spawned; /* invoked via inetd */
-FLAG standard_port = TRUE; /* true if listening on standard port */
-u_short sock_port; /* port # of tcp listen socket */
-u_short stat_port; /* port # of statistics tcp socket */
+static int Test_socket; /* test socket to answer datagrams */
+static FLAG inetd_spawned; /* invoked via inetd */
+static FLAG standard_port = TRUE; /* true if listening on standard port */
+static u_short sock_port; /* port # of tcp listen socket */
+static u_short stat_port; /* port # of statistics tcp socket */
#define DAEMON_SIZE (sizeof Daemon)
#else
#define DAEMON_SIZE (sizeof Daemon - 1)
diff --git a/hunt/huntd/extern.c b/hunt/huntd/extern.c
index 46dfb12a..bee6851c 100644
--- a/hunt/huntd/extern.c
+++ b/hunt/huntd/extern.c
@@ -1,4 +1,4 @@
-/* $NetBSD: extern.c,v 1.5 2009/07/04 04:29:54 dholland Exp $ */
+/* $NetBSD: extern.c,v 1.6 2009/08/12 07:42:11 dholland Exp $ */
/*
* Copyright (c) 1983-2003, Regents of the University of California.
* All rights reserved.
@@ -32,12 +32,12 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: extern.c,v 1.5 2009/07/04 04:29:54 dholland Exp $");
+__RCSID("$NetBSD: extern.c,v 1.6 2009/08/12 07:42:11 dholland Exp $");
#endif /* not lint */
#include "hunt.h"
-#ifdef MONITOR
+#if 0 /*def MONITOR*/ /* apparently unused (XXX?) */
FLAG Am_monitor = FALSE; /* current process is a monitor */
#endif
diff --git a/hunt/huntd/hunt.h b/hunt/huntd/hunt.h
index 021e6f81..116a418c 100644
--- a/hunt/huntd/hunt.h
+++ b/hunt/huntd/hunt.h
@@ -1,4 +1,4 @@
-/* $NetBSD: hunt.h,v 1.18 2009/07/04 07:51:35 dholland Exp $ */
+/* $NetBSD: hunt.h,v 1.19 2009/08/12 07:42:11 dholland Exp $ */
/*
* Copyright (c) 1983-2003, Regents of the University of California.
@@ -412,7 +412,6 @@ void add_shot(int, int, int, char, int, PLAYER *, int, char);
int answer(void);
void bad_con(void) __dead;
void bad_ver(void) __dead;
-int broadcast_vec(int, struct sockaddr **);
void ce(PLAYER *);
void cgoto(PLAYER *, int, int);
void check(PLAYER *, int, int);
@@ -427,12 +426,9 @@ void do_connect(char *, char, long);
void do_message(void);
void drawmaze(PLAYER *);
void drawplayer(PLAYER *, FLAG);
-void drawstatus(PLAYER *);
void execute(PLAYER *);
void faketalk(void);
-void find_driver(FLAG);
void fixshots(int, int, char);
-IDENT *get_ident(uint32_t, uint32_t, char *, char);
void get_local_name(char *);
int get_remote_name(char *);
BULLET *is_bullet(int, int);
@@ -446,7 +442,6 @@ int opposite(int, char);
void otto(int, int, char);
void outch(PLAYER *, int);
void outstr(PLAYER *, const char *, int);
-int player_sym(PLAYER *, int, int);
PLAYER *play_at(int, int);
void playit(void);
void put_ch(char);
@@ -454,21 +449,10 @@ void put_str(char *);
int quit(int);
int rand_dir(void);
int rand_num(int);
-void redraw_screen(void);
-void rmnl(char *);
void rollexpl(void);
-void see(PLAYER *, int);
void sendcom(PLAYER *, int, ...);
void showexpl(int, int, char);
void showstat(PLAYER *);
-void start_driver(void);
-void stmonitor(PLAYER *);
-void stplayer(PLAYER *, int);
-char translate(char);
void cleanup(int) __dead;
void intr(int);
-void sigalrm(int);
-void sigemt(int) __dead;
-void sigterm(int) __dead;
-void sigusr1(int) __dead;
void tstp(int);
diff --git a/hunt/huntd/makemaze.c b/hunt/huntd/makemaze.c
index 47a01bb3..dd52ee4a 100644
--- a/hunt/huntd/makemaze.c
+++ b/hunt/huntd/makemaze.c
@@ -1,4 +1,4 @@
-/* $NetBSD: makemaze.c,v 1.6 2009/07/04 04:29:55 dholland Exp $ */
+/* $NetBSD: makemaze.c,v 1.7 2009/08/12 07:42:11 dholland Exp $ */
/*
* Copyright (c) 1983-2003, Regents of the University of California.
* All rights reserved.
@@ -32,7 +32,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: makemaze.c,v 1.6 2009/07/04 04:29:55 dholland Exp $");
+__RCSID("$NetBSD: makemaze.c,v 1.7 2009/08/12 07:42:11 dholland Exp $");
#endif /* not lint */
#include "hunt.h"
@@ -67,7 +67,7 @@ makemaze(void)
#define NPERM 24
#define NDIR 4
-int dirs[NPERM][NDIR] = {
+static int dirs[NPERM][NDIR] = {
{0,1,2,3}, {3,0,1,2}, {0,2,3,1}, {0,3,2,1},
{1,0,2,3}, {2,3,0,1}, {0,2,1,3}, {2,3,1,0},
{1,0,3,2}, {1,2,0,3}, {3,1,2,0}, {2,0,3,1},
@@ -76,7 +76,7 @@ int dirs[NPERM][NDIR] = {
{2,1,3,0}, {3,0,2,1}, {3,2,0,1}, {3,2,1,0}
};
-int incr[NDIR][2] = {
+static int incr[NDIR][2] = {
{0, 1}, {1, 0}, {0, -1}, {-1, 0}
};