From c10b9a8ce82ad7b4b287ccc5b5b576ab961aa488 Mon Sep 17 00:00:00 2001 From: dholland Date: Wed, 12 Aug 2009 07:42:11 +0000 Subject: sprinkle static and prune some dead code --- hunt/huntd/answer.c | 14 +++++++++----- hunt/huntd/draw.c | 17 +++++++++++------ hunt/huntd/driver.c | 22 +++++++++++----------- hunt/huntd/extern.c | 6 +++--- hunt/huntd/hunt.h | 18 +----------------- hunt/huntd/makemaze.c | 8 ++++---- 6 files changed, 39 insertions(+), 46 deletions(-) (limited to 'hunt/huntd') 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 #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 @@ -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 #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 #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 @@ -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 #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 #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} }; -- cgit v1.2.3-56-ge451