Module Name: src
Committed By: dholland
Date: Sat Mar 29 21:56:00 UTC 2014
Modified Files:
src/games/hunt/huntd: driver.c extern.c hunt.h
src/games/hunt/include: hunt_common.h
Log Message:
Additional minor cleanup and remove a straggler data declaration
from hunt_common.h.
To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/games/hunt/huntd/driver.c
cvs rdiff -u -r1.8 -r1.9 src/games/hunt/huntd/extern.c
cvs rdiff -u -r1.25 -r1.26 src/games/hunt/huntd/hunt.h
cvs rdiff -u -r1.2 -r1.3 src/games/hunt/include/hunt_common.h
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/huntd/driver.c
diff -u src/games/hunt/huntd/driver.c:1.29 src/games/hunt/huntd/driver.c:1.30
--- src/games/hunt/huntd/driver.c:1.29 Sat Mar 29 21:33:41 2014
+++ src/games/hunt/huntd/driver.c Sat Mar 29 21:55:59 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: driver.c,v 1.29 2014/03/29 21:33:41 dholland Exp $ */
+/* $NetBSD: driver.c,v 1.30 2014/03/29 21:55:59 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.29 2014/03/29 21:33:41 dholland Exp $");
+__RCSID("$NetBSD: driver.c,v 1.30 2014/03/29 21:55:59 dholland Exp $");
#endif /* not lint */
#include <sys/ioctl.h>
@@ -47,7 +47,7 @@ __RCSID("$NetBSD: driver.c,v 1.29 2014/0
#ifdef INTERNET
-static u_short Test_port = TEST_PORT;
+static uint16_t Test_port = TEST_PORT;
#else
static const char Sock_name[] = "/tmp/hunt";
static const char Stat_name[] = "/tmp/hunt.stats";
@@ -822,11 +822,11 @@ havechar(PLAYER *pp, int i)
if (!(fdset[i].revents & POLLIN))
return false;
check_again:
- errno = 0;
- if ((pp->p_nchar = read(pp->p_fd, pp->p_cbuf, sizeof pp->p_cbuf)) <= 0)
- {
+ pp->p_nchar = read(pp->p_fd, pp->p_cbuf, sizeof pp->p_cbuf);
+ if (pp->p_nchar < 0 && errno == EINTR) {
+ goto check_again;
+ } else if (pp->p_nchar <= 0) {
if (errno == EINTR)
- goto check_again;
pp->p_cbuf[0] = 'q';
}
pp->p_ncount = 0;
@@ -838,7 +838,7 @@ check_again:
* Exit with the given value, cleaning up any droppings lying around
*/
void
-cleanup(int eval)
+cleanup(int exitval)
{
PLAYER *pp;
@@ -861,7 +861,7 @@ cleanup(int eval)
(void) unlink(Sock_name);
#endif
- exit(eval);
+ exit(exitval);
}
/*
Index: src/games/hunt/huntd/extern.c
diff -u src/games/hunt/huntd/extern.c:1.8 src/games/hunt/huntd/extern.c:1.9
--- src/games/hunt/huntd/extern.c:1.8 Sat Mar 29 21:33:41 2014
+++ src/games/hunt/huntd/extern.c Sat Mar 29 21:55:59 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: extern.c,v 1.8 2014/03/29 21:33:41 dholland Exp $ */
+/* $NetBSD: extern.c,v 1.9 2014/03/29 21:55:59 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: extern.c,v 1.8 2014/03/29 21:33:41 dholland Exp $");
+__RCSID("$NetBSD: extern.c,v 1.9 2014/03/29 21:55:59 dholland Exp $");
#endif /* not lint */
#include "hunt.h"
@@ -65,20 +65,22 @@ PLAYER Monitor[MAXMON]; /* all the mon
PLAYER *End_monitor = Monitor; /* last active monitor slot */
#endif
-int shot_req[MAXBOMB] = {
+const int shot_req[MAXBOMB] = {
BULREQ, GRENREQ, SATREQ,
BOMB7REQ, BOMB9REQ, BOMB11REQ,
BOMB13REQ, BOMB15REQ, BOMB17REQ,
BOMB19REQ, BOMB21REQ,
};
-int shot_type[MAXBOMB] = {
+const int shot_type[MAXBOMB] = {
SHOT, GRENADE, SATCHEL,
BOMB, BOMB, BOMB,
BOMB, BOMB, BOMB,
BOMB, BOMB,
};
-int slime_req[MAXSLIME] = {
+#ifdef OOZE
+const int slime_req[MAXSLIME] = {
SLIMEREQ, SSLIMEREQ, SLIME2REQ, SLIME3REQ,
};
+#endif
Index: src/games/hunt/huntd/hunt.h
diff -u src/games/hunt/huntd/hunt.h:1.25 src/games/hunt/huntd/hunt.h:1.26
--- src/games/hunt/huntd/hunt.h:1.25 Sat Mar 29 21:43:46 2014
+++ src/games/hunt/huntd/hunt.h Sat Mar 29 21:55:59 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: hunt.h,v 1.25 2014/03/29 21:43:46 dholland Exp $ */
+/* $NetBSD: hunt.h,v 1.26 2014/03/29 21:55:59 dholland Exp $ */
/*
* Copyright (c) 1983-2003, Regents of the University of California.
@@ -55,8 +55,11 @@
#include "hunt_common.h"
-extern int shot_req[];
-extern int shot_type[];
+extern const int shot_req[];
+extern const int shot_type[];
+#ifdef OOZE
+extern const int slime_req[];
+#endif
typedef struct bullet_def BULLET;
typedef struct expl_def EXPL;
Index: src/games/hunt/include/hunt_common.h
diff -u src/games/hunt/include/hunt_common.h:1.2 src/games/hunt/include/hunt_common.h:1.3
--- src/games/hunt/include/hunt_common.h:1.2 Sat Mar 29 21:25:35 2014
+++ src/games/hunt/include/hunt_common.h Sat Mar 29 21:55:59 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: hunt_common.h,v 1.2 2014/03/29 21:25:35 dholland Exp $ */
+/* $NetBSD: hunt_common.h,v 1.3 2014/03/29 21:55:59 dholland Exp $ */
/*
* Copyright (c) 1983-2003, Regents of the University of California.
@@ -206,7 +206,6 @@
#define SLIME3REQ 20
#define MAXSLIME 4
#define SLIMESPEED 5
-extern int slime_req[];
#endif
#ifdef VOLCANO
#define LAVASPEED 1