sprinkle static and prune some dead code
This commit is contained in:
parent
9b92b18917
commit
75b3905d60
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue