Module Name:    src
Committed By:   dholland
Date:           Wed Aug 12 07:42:11 UTC 2009

Modified Files:
        src/games/hunt/hunt: hunt.c playit.c
        src/games/hunt/huntd: answer.c draw.c driver.c extern.c hunt.h
            makemaze.c

Log Message:
sprinkle static and prune some dead code


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/games/hunt/hunt/hunt.c
cvs rdiff -u -r1.14 -r1.15 src/games/hunt/hunt/playit.c
cvs rdiff -u -r1.14 -r1.15 src/games/hunt/huntd/answer.c
cvs rdiff -u -r1.7 -r1.8 src/games/hunt/huntd/draw.c
cvs rdiff -u -r1.19 -r1.20 src/games/hunt/huntd/driver.c
cvs rdiff -u -r1.5 -r1.6 src/games/hunt/huntd/extern.c
cvs rdiff -u -r1.18 -r1.19 src/games/hunt/huntd/hunt.h
cvs rdiff -u -r1.6 -r1.7 src/games/hunt/huntd/makemaze.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/games/hunt/hunt/hunt.c
diff -u src/games/hunt/hunt/hunt.c:1.35 src/games/hunt/hunt/hunt.c:1.36
--- src/games/hunt/hunt/hunt.c:1.35	Sat Jul  4 07:51:34 2009
+++ src/games/hunt/hunt/hunt.c	Wed Aug 12 07:42:11 2009
@@ -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 @@
 
 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 @@
 
 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 @@
 }
 
 #ifdef INTERNET
-int
+static int
 broadcast_vec(int s /*socket*/, struct sockaddr **vector)
 {
 	int vec_cnt;
@@ -506,7 +511,7 @@
 	goto get_response;
 }
 
-void
+static void
 find_driver(FLAG do_startup)
 {
 	SOCKET *hosts;
@@ -556,7 +561,7 @@
 	find_driver(FALSE);
 }
 
-void
+static void
 dump_scores(SOCKET host)
 {
 	struct hostent *hp;
@@ -581,7 +586,7 @@
 
 #endif
 
-void
+static void
 start_driver(void)
 {
 	int procid;
@@ -655,7 +660,7 @@
  * sigterm:
  *	Handle a terminate signal
  */
-void
+static void
 sigterm(int dummy __unused)
 {
 	leavex(0, NULL);
@@ -667,30 +672,18 @@
  * 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 @@
 	}
 }
 
-void
+static void
 fincurs(void)
 {
 	if (in_visual) {
@@ -781,7 +774,7 @@
 	errx(eval, mesg ? mesg : "");
 }
 
-long
+static long
 env_init(long enter_status)
 {
 	int i;
@@ -890,7 +883,7 @@
 	return enter_status;
 }
 
-void
+static void
 fill_in_blanks(void)
 {
 	int i;

Index: src/games/hunt/hunt/playit.c
diff -u src/games/hunt/hunt/playit.c:1.14 src/games/hunt/hunt/playit.c:1.15
--- src/games/hunt/hunt/playit.c:1.14	Sat Jul  4 07:51:34 2009
+++ src/games/hunt/hunt/playit.c	Wed Aug 12 07:42:11 2009
@@ -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 getchr(void);
 static void send_stuff(void);
+static void redraw_screen(void);
 
 /*
  * playit:
@@ -415,7 +416,7 @@
 	refresh();
 }
 
-void
+static void
 redraw_screen(void)
 {
 	clearok(stdscr, TRUE);

Index: src/games/hunt/huntd/answer.c
diff -u src/games/hunt/huntd/answer.c:1.14 src/games/hunt/huntd/answer.c:1.15
--- src/games/hunt/huntd/answer.c:1.14	Sat Jul  4 04:29:54 2009
+++ src/games/hunt/huntd/answer.c	Wed Aug 12 07:42:11 2009
@@ -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 @@
 
 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 @@
 }
 
 #ifdef MONITOR
-void
+static void
 stmonitor(PLAYER *pp)
 {
 	int line;
@@ -232,7 +236,7 @@
 }
 #endif
 
-void
+static void
 stplayer(PLAYER *newpp, int enter_status)
 {
 	int x, y;
@@ -380,7 +384,7 @@
  * 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;

Index: src/games/hunt/huntd/draw.c
diff -u src/games/hunt/huntd/draw.c:1.7 src/games/hunt/huntd/draw.c:1.8
--- src/games/hunt/huntd/draw.c:1.7	Sat Jul  4 04:29:54 2009
+++ src/games/hunt/huntd/draw.c	Wed Aug 12 07:42:11 2009
@@ -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 @@
  * 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 @@
 	cgoto(pp, y, x);
 }
 
-void
+static void
 see(PLAYER *pp, int face)
 {
 	char *sp;
@@ -355,7 +360,7 @@
  *	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 @@
  * player_sym:
  *	Return the player symbol
  */
-int
+static int
 player_sym(PLAYER *pp, int y, int x)
 {
 	PLAYER *npp;

Index: src/games/hunt/huntd/driver.c
diff -u src/games/hunt/huntd/driver.c:1.19 src/games/hunt/huntd/driver.c:1.20
--- src/games/hunt/huntd/driver.c:1.19	Sat Jul  4 06:38:35 2009
+++ src/games/hunt/huntd/driver.c	Wed Aug 12 07:42:11 2009
@@ -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 @@
 #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)

Index: src/games/hunt/huntd/extern.c
diff -u src/games/hunt/huntd/extern.c:1.5 src/games/hunt/huntd/extern.c:1.6
--- src/games/hunt/huntd/extern.c:1.5	Sat Jul  4 04:29:54 2009
+++ src/games/hunt/huntd/extern.c	Wed Aug 12 07:42:11 2009
@@ -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
 

Index: src/games/hunt/huntd/hunt.h
diff -u src/games/hunt/huntd/hunt.h:1.18 src/games/hunt/huntd/hunt.h:1.19
--- src/games/hunt/huntd/hunt.h:1.18	Sat Jul  4 07:51:35 2009
+++ src/games/hunt/huntd/hunt.h	Wed Aug 12 07:42:11 2009
@@ -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 @@
 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_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 @@
 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 @@
 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);

Index: src/games/hunt/huntd/makemaze.c
diff -u src/games/hunt/huntd/makemaze.c:1.6 src/games/hunt/huntd/makemaze.c:1.7
--- src/games/hunt/huntd/makemaze.c:1.6	Sat Jul  4 04:29:55 2009
+++ src/games/hunt/huntd/makemaze.c	Wed Aug 12 07:42:11 2009
@@ -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 @@
 #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 @@
 	{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}
 };
 

Reply via email to