-/* $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.
#include <sys/cdefs.h>
#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 <sys/ioctl.h>
#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)
PLAYER *pp;
#ifdef INTERNET
u_short msg;
- short port_num, reply;
+ short reply;
socklen_t namelen;
SOCKET test;
#endif
#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)) {
(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
/*
fdset[2].fd = -1;
#endif
- Seed = getpid() + time((time_t *) NULL);
+ Seed = getpid() + time(NULL);
makemaze();
#ifdef BOOTS
makeboots();
BULLET *bp;
PLAYER *np;
int x, y;
- int savefd;
if (was_player) {
if (pp->p_undershot)
outstr(pp, pp->p_death, len);
cgoto(pp, HEIGHT, 0);
- savefd = pp->p_fd;
-
#ifdef MONITOR
if (was_player) {
#endif
}
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++)
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;
add_shot(DSHOT, y, x, rand_dir(),
shot_req[MINDSHOT +
rand_num(MAXBOMB - MINDSHOT)],
- (PLAYER *) NULL, FALSE, SPACE);
+ NULL, FALSE, SPACE);
}
#endif
* cleanup:
* Exit with the given value, cleaning up any droppings lying around
*/
-SIGNAL_TYPE
+void
cleanup(int eval)
{
PLAYER *pp;