X-Git-Url: https://git.cameronkatri.com/bsdgames-darwin.git/blobdiff_plain/04000177d6ff81237366452ab49b73a49309a5f6..82159d673f616b12554c28d5ac54f515fec21e91:/hunt/huntd/driver.c diff --git a/hunt/huntd/driver.c b/hunt/huntd/driver.c index f1d79297..ff5411d9 100644 --- a/hunt/huntd/driver.c +++ b/hunt/huntd/driver.c @@ -1,4 +1,4 @@ -/* $NetBSD: driver.c,v 1.17 2009/07/04 04:29:54 dholland Exp $ */ +/* $NetBSD: driver.c,v 1.22 2013/10/19 17:23:08 christos 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.17 2009/07/04 04:29:54 dholland Exp $"); +__RCSID("$NetBSD: driver.c,v 1.22 2013/10/19 17:23:08 christos Exp $"); #endif /* not lint */ #include @@ -51,19 +51,19 @@ __RCSID("$NetBSD: driver.c,v 1.17 2009/07/04 04:29:54 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) @@ -88,7 +88,7 @@ main(int ac, char **av, char **ep) PLAYER *pp; #ifdef INTERNET u_short msg; - short port_num, reply; + short reply; socklen_t namelen; SOCKET test; #endif @@ -143,7 +143,6 @@ again: #ifdef INTERNET if (fdset[2].revents & POLLIN) { namelen = DAEMON_SIZE; - port_num = htons(sock_port); (void) recvfrom(Test_socket, &msg, sizeof msg, 0, (struct sockaddr *) &test, &namelen); switch (ntohs(msg)) { @@ -279,12 +278,7 @@ init(void) (void) signal(SIGPIPE, SIG_IGN); #ifdef LOG -#ifdef SYSLOG_43 openlog("huntd", LOG_PID, LOG_DAEMON); -#endif -#ifdef SYSLOG_42 - openlog("huntd", LOG_PID); -#endif #endif /* @@ -417,7 +411,7 @@ init(void) fdset[2].fd = -1; #endif - Seed = getpid() + time((time_t *) NULL); + Seed = getpid() + time(NULL); makemaze(); #ifdef BOOTS makeboots(); @@ -604,7 +598,6 @@ zap(PLAYER *pp, FLAG was_player, int i) BULLET *bp; PLAYER *np; int x, y; - int savefd; if (was_player) { if (pp->p_undershot) @@ -627,8 +620,6 @@ zap(PLAYER *pp, FLAG was_player, int i) outstr(pp, pp->p_death, len); cgoto(pp, HEIGHT, 0); - savefd = pp->p_fd; - #ifdef MONITOR if (was_player) { #endif @@ -667,7 +658,7 @@ zap(PLAYER *pp, FLAG was_player, int i) } if (x > 0) { (void) add_shot(len, pp->p_y, pp->p_x, pp->p_face, x, - (PLAYER *) NULL, TRUE, SPACE); + NULL, TRUE, SPACE); (void) snprintf(Buf, sizeof(Buf), "%s detonated.", pp->p_ident->i_name); for (np = Player; np < End_player; np++) @@ -715,7 +706,7 @@ zap(PLAYER *pp, FLAG was_player, int i) y = rand_num(HEIGHT / 2) + HEIGHT / 4; } while (Maze[y][x] != SPACE); (void) add_shot(LAVA, y, x, LEFTS, volcano, - (PLAYER *) NULL, TRUE, SPACE); + NULL, TRUE, SPACE); for (np = Player; np < End_player; np++) message(np, "Volcano eruption."); volcano = 0; @@ -731,7 +722,7 @@ zap(PLAYER *pp, FLAG was_player, int i) add_shot(DSHOT, y, x, rand_dir(), shot_req[MINDSHOT + rand_num(MAXBOMB - MINDSHOT)], - (PLAYER *) NULL, FALSE, SPACE); + NULL, FALSE, SPACE); } #endif @@ -852,7 +843,7 @@ check_again: * cleanup: * Exit with the given value, cleaning up any droppings lying around */ -SIGNAL_TYPE +void cleanup(int eval) { PLAYER *pp;