summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlukem <lukem@NetBSD.org>1997-10-10 16:32:15 +0000
committerlukem <lukem@NetBSD.org>1997-10-10 16:32:15 +0000
commit50f99331097302f77db413ba7ad7299d928163eb (patch)
tree376410fecfef0c2ac47f5b4f0643e6a84a373cdc
parenta25e10613cc56cac1b954b119f757a272dee9bc8 (diff)
downloadbsdgames-darwin-50f99331097302f77db413ba7ad7299d928163eb.tar.gz
bsdgames-darwin-50f99331097302f77db413ba7ad7299d928163eb.tar.zst
bsdgames-darwin-50f99331097302f77db413ba7ad7299d928163eb.zip
Yet Another Monster Commit:
- WARNSify - getopt returns -1 not EOF - select() uses an fd_set, not int/long; modify code to use FD_* et al instead of direct bitwise operations - in otto.c::look (renamed to ottolook() to prevent name clash), the case WEST section had a 'goto cont_east', instead of 'goto cont_west'. (picked up by WARNS=1, because cont_west was an unused label because of this typo). probably meant that otto got lost in the maze :-/ - deprecate register, convert bcmp() -> memcmp()
-rw-r--r--hunt/Makefile.inc4
-rw-r--r--hunt/hunt/connect.c9
-rw-r--r--hunt/hunt/hunt.62
-rw-r--r--hunt/hunt/hunt.c105
-rw-r--r--hunt/hunt/otto.c79
-rw-r--r--hunt/hunt/playit.c75
-rw-r--r--hunt/huntd/answer.c48
-rw-r--r--hunt/huntd/ctl.c8
-rw-r--r--hunt/huntd/ctl_transact.c17
-rw-r--r--hunt/huntd/draw.c94
-rw-r--r--hunt/huntd/driver.c149
-rw-r--r--hunt/huntd/execute.c96
-rw-r--r--hunt/huntd/expl.c42
-rw-r--r--hunt/huntd/extern.c12
-rw-r--r--hunt/huntd/faketalk.c26
-rw-r--r--hunt/huntd/get_names.c19
-rw-r--r--hunt/huntd/hunt.h77
-rw-r--r--hunt/huntd/makemaze.c49
-rw-r--r--hunt/huntd/pathname.c6
-rw-r--r--hunt/huntd/shots.c146
-rw-r--r--hunt/huntd/talk_ctl.h4
-rw-r--r--hunt/huntd/terminal.c71
22 files changed, 740 insertions, 398 deletions
diff --git a/hunt/Makefile.inc b/hunt/Makefile.inc
index a0039bcf..b27c37d6 100644
--- a/hunt/Makefile.inc
+++ b/hunt/Makefile.inc
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.inc,v 1.1 1997/10/04 09:11:16 mrg Exp $
+# $NetBSD: Makefile.inc,v 1.2 1997/10/10 16:32:15 lukem Exp $
#
# Hunt
# Copyright (c) 1985 Conrad C. Huang, Gregory S. Couch, Kenneth C.R.C. Arnold
@@ -64,4 +64,4 @@ SYSLIBS=
DEFS= $(GAME_PARAM) $(DEFS_BSD44)
CFLAGS+= -O2 $(SYSCFLAGS) $(DEFS) -DHUNTD=\"/usr/games/huntd\"
-.include "../../Makefile.inc"
+.include "../Makefile.inc"
diff --git a/hunt/hunt/connect.c b/hunt/hunt/connect.c
index 587f8b40..ae91c2ab 100644
--- a/hunt/hunt/connect.c
+++ b/hunt/hunt/connect.c
@@ -1,12 +1,20 @@
+/* $NetBSD: connect.c,v 1.2 1997/10/10 16:32:23 lukem Exp $ */
/*
* Hunt
* Copyright (c) 1985 Conrad C. Huang, Gregory S. Couch, Kenneth C.R.C. Arnold
* San Francisco, California
*/
+#include <sys/cdefs.h>
+#ifndef lint
+__RCSID("$NetBSD: connect.c,v 1.2 1997/10/10 16:32:23 lukem Exp $");
+#endif /* not lint */
+
# include "hunt.h"
# include <signal.h>
+# include <unistd.h>
+void
do_connect(name, team, enter_status)
char *name;
char team;
@@ -14,7 +22,6 @@ long enter_status;
{
static long uid;
static long mode;
- extern char *ttyname();
if (uid == 0)
uid = htonl(getuid());
diff --git a/hunt/hunt/hunt.6 b/hunt/hunt/hunt.6
index da6b49db..b45d8271 100644
--- a/hunt/hunt/hunt.6
+++ b/hunt/hunt/hunt.6
@@ -1,3 +1,5 @@
+.\" $NetBSD: hunt.6,v 1.3 1997/10/10 16:32:30 lukem Exp $
+.\"
.\" hunt
.\" Copyright (c) 1985 Conrad C. Huang, Gregory S. Couch, Kenneth C.R.C. Arnold
.\" San Francisco, California
diff --git a/hunt/hunt/hunt.c b/hunt/hunt/hunt.c
index 6599b87e..f92f6bf5 100644
--- a/hunt/hunt/hunt.c
+++ b/hunt/hunt/hunt.c
@@ -1,21 +1,30 @@
+/* $NetBSD: hunt.c,v 1.2 1997/10/10 16:32:34 lukem Exp $ */
/*
* Hunt
* Copyright (c) 1985 Conrad C. Huang, Gregory S. Couch, Kenneth C.R.C. Arnold
* San Francisco, California
*/
+#include <sys/cdefs.h>
+#ifndef lint
+__RCSID("$NetBSD: hunt.c,v 1.2 1997/10/10 16:32:34 lukem Exp $");
+#endif /* not lint */
+
+# include <sys/stat.h>
+# include <sys/time.h>
+# include <ctype.h>
# include <errno.h>
+# include <curses.h>
+# include <signal.h>
+# include <stdlib.h>
+# include <string.h>
# if !defined(USE_CURSES) && defined(BSD_RELEASE) && BSD_RELEASE >= 44
# include <termios.h>
static struct termios saved_tty;
# endif
-# include <curses.h>
-# include <string.h>
+# include <unistd.h>
+
# include "hunt.h"
-# include <signal.h>
-# include <ctype.h>
-# include <sys/stat.h>
-# include <sys/time.h>
/*
* Some old versions of curses don't have these defined
@@ -73,19 +82,24 @@ static char team = ' ';
static int in_visual;
extern int cur_row, cur_col;
-extern char *tgoto();
+void dump_scores __P((SOCKET));
+long env_init __P((long));
+void fill_in_blanks __P((void));
+void leave __P((int, char *));
+int main __P((int, char *[]));
# ifdef INTERNET
-extern SOCKET *list_drivers();
+SOCKET *list_drivers __P((void));
# endif
/*
* main:
* Main program for local process
*/
+int
main(ac, av)
-int ac;
-char **av;
+ int ac;
+ char **av;
{
char *term;
int c;
@@ -94,11 +108,9 @@ char **av;
extern int optind;
extern char *optarg;
long enter_status;
- SIGNAL_TYPE intr(), sigterm(), sigemt(), tstp();
- long env_init(), quit();
enter_status = env_init((long) Q_CLOAK);
- while ((c = getopt(ac, av, "Sbcfh:l:mn:op:qst:w:")) != EOF) {
+ while ((c = getopt(ac, av, "Sbcfh:l:mn:op:qst:w:")) != -1) {
switch (c) {
case 'l': /* rsh compatibility */
case 'n':
@@ -341,10 +353,12 @@ char **av;
}
leave(0, (char *) NULL);
/* NOTREACHED */
+ return(0);
}
# ifdef INTERNET
# ifdef BROADCAST
+int
broadcast_vec(s, vector)
int s; /* socket */
struct sockaddr **vector;
@@ -383,7 +397,7 @@ list_drivers()
char local_name[256];
static initial = TRUE;
static struct in_addr local_address;
- register struct hostent *hp;
+ struct hostent *hp;
extern int errno;
# ifdef BROADCAST
static int brdc;
@@ -395,7 +409,7 @@ list_drivers()
static SOCKET *listv;
static unsigned int listmax;
unsigned int listc;
- int mask;
+ fd_set mask;
struct timeval wait;
if (initial) { /* do one time initialization */
@@ -502,10 +516,10 @@ get_response:
listmax * sizeof(SOCKET));
}
- mask = 1 << test_socket;
- if (select(test_socket + 1, &mask, NULL, NULL, &wait) == 1
- && recvfrom(test_socket, (char *) &port_num, sizeof port_num,
- 0, (struct sockaddr *) &listv[listc], &namelen) > 0) {
+ FD_SET(test_socket, &mask);
+ if (select(test_socket + 1, &mask, NULL, NULL, &wait) == 1 &&
+ recvfrom(test_socket, (char *) &port_num, sizeof(port_num),
+ 0, (struct sockaddr *) &listv[listc], &namelen) > 0) {
/*
* Note that we do *not* convert from network to host
* order since the port number *should* be in network
@@ -543,8 +557,9 @@ test_one_host:
goto get_response;
}
+void
find_driver(do_startup)
-FLAG do_startup;
+ FLAG do_startup;
{
SOCKET *hosts;
@@ -610,6 +625,7 @@ FLAG do_startup;
find_driver(FALSE);
}
+void
dump_scores(host)
SOCKET host;
{
@@ -639,9 +655,10 @@ dump_scores(host)
# endif
+void
start_driver()
{
- register int procid;
+ int procid;
# ifdef MONITOR
if (Am_monitor) {
@@ -703,6 +720,7 @@ start_driver()
* We had a bad connection. For the moment we assume that this
* means the game is full.
*/
+void
bad_con()
{
leave(1, "The game is full. Sorry.");
@@ -713,6 +731,7 @@ bad_con()
* bad_ver:
* version number mismatch.
*/
+void
bad_ver()
{
leave(1, "Version number mismatch. No go.");
@@ -724,7 +743,8 @@ bad_ver()
* Handle a terminate signal
*/
SIGNAL_TYPE
-sigterm()
+sigterm(dummy)
+ int dummy;
{
leave(0, (char *) NULL);
/* NOTREACHED */
@@ -736,7 +756,8 @@ sigterm()
* Handle a emt signal - shouldn't happen on vaxes(?)
*/
SIGNAL_TYPE
-sigemt()
+sigemt(dummy)
+ int dummy;
{
leave(1, "Unable to start driver. Try again.");
/* NOTREACHED */
@@ -748,7 +769,8 @@ sigemt()
* Handle an alarm signal
*/
SIGNAL_TYPE
-sigalrm()
+sigalrm(dummy)
+ int dummy;
{
return;
}
@@ -758,10 +780,11 @@ sigalrm()
* rmnl:
* Remove a '\n' at the end of a string if there is one
*/
+void
rmnl(s)
-char *s;
+ char *s;
{
- register char *cp;
+ char *cp;
cp = strrchr(s, '\n');
if (cp != NULL)
@@ -773,11 +796,12 @@ char *s;
* Handle a interrupt signal
*/
SIGNAL_TYPE
-intr()
+intr(dummy)
+ int dummy;
{
- register int ch;
- register int explained;
- register int y, x;
+ int ch;
+ int explained;
+ int y, x;
(void) signal(SIGINT, SIG_IGN);
# ifdef USE_CURSES
@@ -832,9 +856,10 @@ intr()
* Leave the game somewhat gracefully, restoring all current
* tty stats.
*/
+void
leave(eval, mesg)
-int eval;
-char *mesg;
+ int eval;
+ char *mesg;
{
if (in_visual) {
# ifdef USE_CURSES
@@ -864,7 +889,8 @@ char *mesg;
* Handle stop and start signals
*/
SIGNAL_TYPE
-tstp()
+tstp(dummy)
+ int dummy;
{
# if BSD_RELEASE < 44
static struct sgttyb tty;
@@ -908,10 +934,10 @@ tstp()
# if defined(BSD_RELEASE) && BSD_RELEASE < 43
char *
strpbrk(s, brk)
- register char *s, *brk;
+ char *s, *brk;
{
- register char *p;
- register c;
+ char *p;
+ c;
while (c = *s) {
for (p = brk; *p; p++)
@@ -927,7 +953,7 @@ long
env_init(enter_status)
long enter_status;
{
- register int i;
+ int i;
char *envp, *envname, *s;
for (i = 0; i < 256; i++)
@@ -1032,10 +1058,11 @@ env_init(enter_status)
return enter_status;
}
+void
fill_in_blanks()
{
- register int i;
- register char *cp;
+ int i;
+ char *cp;
again:
if (name[0] != '\0') {
diff --git a/hunt/hunt/otto.c b/hunt/hunt/otto.c
index ab3b9029..773ceb7e 100644
--- a/hunt/hunt/otto.c
+++ b/hunt/hunt/otto.c
@@ -1,3 +1,4 @@
+/* $NetBSD: otto.c,v 1.2 1997/10/10 16:32:39 lukem Exp $ */
# ifdef OTTO
/*
* otto - a hunt otto-matic player
@@ -7,15 +8,21 @@
* automatic players to link to. If you write your own "otto"
* please let us know what subroutines you would expect in the
* subroutine library.
- *
- * $Id: otto.c,v 1.1.1.1 1997/10/04 09:00:14 mrg Exp $
*/
+#include <sys/cdefs.h>
+#ifndef lint
+__RCSID("$NetBSD: otto.c,v 1.2 1997/10/10 16:32:39 lukem Exp $");
+#endif /* not lint */
+
+# include <sys/time.h>
# include <curses.h>
# include <ctype.h>
-# include "hunt.h"
-# include <sys/time.h>
# include <signal.h>
+# include <stdlib.h>
+# include <unistd.h>
+# include "hunt.h"
+
# undef WALL
# undef NORTH
# undef SOUTH
@@ -106,24 +113,28 @@ STATIC int num_turns; /* for wandering */
STATIC char been_there[HEIGHT][WIDTH2];
STATIC struct itimerval pause_time = { { 0, 0 }, { 0, 55000 }};
-STATIC int stop_look();
-STATIC int look_around();
-STATIC int face_and_move_direction();
-STATIC int attack();
-STATIC int duck();
-STATIC int go_for_ammo();
-STATIC int wander();
+STATIC void attack __P((int, struct item *));
+STATIC void duck __P((int));
+STATIC void face_and_move_direction __P((int, int));
+STATIC int go_for_ammo __P((char));
+STATIC void ottolook __P((int, struct item *));
+STATIC void look_around __P((void));
+STATIC SIGNAL_TYPE nothing __P((int));
+STATIC int stop_look __P((struct item *, char, int, int));
+STATIC void wander __P((void));
STATIC SIGNAL_TYPE
-nothing()
+nothing(dummy)
+ int dummy;
{
}
+void
otto(y, x, face)
int y, x;
char face;
{
- register int i;
+ int i;
extern int Otto_count;
int old_mask;
@@ -190,7 +201,7 @@ done:
# define direction(abs,rel) (((abs) + (rel)) % NUMDIRECTIONS)
-STATIC
+STATIC int
stop_look(itemp, c, dist, side)
struct item *itemp;
char c;
@@ -265,13 +276,15 @@ stop_look(itemp, c, dist, side)
}
}
-look(rel_dir, itemp)
+STATIC void
+ottolook(rel_dir, itemp)
int rel_dir;
struct item *itemp;
{
- register int r, c;
- register char ch;
+ int r, c;
+ char ch;
+ r = 0;
itemp->what = 0;
itemp->distance = -1;
itemp->flags = DEADEND|BEEN; /* true until proven false */
@@ -325,7 +338,7 @@ look(rel_dir, itemp)
for (r = row - 1; r < row + 2; r++) {
ch = SCREEN(r, c);
if (stop_look(itemp, ch, col - c, row - r))
- goto cont_east;
+ goto cont_west;
if (r == row && !been_there[r][c])
itemp->flags &= ~BEEN;
}
@@ -363,15 +376,15 @@ look(rel_dir, itemp)
}
}
-STATIC
+STATIC void
look_around()
{
- register int i;
+ int i;
for (i = 0; i < NUMDIRECTIONS; i++) {
- look(i, &flbr[i]);
+ ottolook(i, &flbr[i]);
# ifdef DEBUG
- fprintf(debug, " look(%c)=%c(%d)(0x%x)",
+ fprintf(debug, " ottolook(%c)=%c(%d)(0x%x)",
RELCHARS[i], flbr[i].what, flbr[i].distance, flbr[i].flags);
# endif
}
@@ -381,23 +394,23 @@ look_around()
* as a side effect modifies facing and location (row, col)
*/
-STATIC
+STATIC void
face_and_move_direction(rel_dir, distance)
int rel_dir, distance;
{
- register int old_facing;
- register char cmd;
+ int old_facing;
+ char cmd;
old_facing = facing;
cmd = DIRKEYS[facing = direction(facing, rel_dir)];
if (rel_dir != FRONT) {
- register int i;
+ int i;
struct item items[NUMDIRECTIONS];
command[comlen++] = toupper(cmd);
if (distance == 0) {
- /* rotate look's to be in right position */
+ /* rotate ottolook's to be in right position */
for (i = 0; i < NUMDIRECTIONS; i++)
items[i] =
flbr[(i + old_facing) % NUMDIRECTIONS];
@@ -418,7 +431,7 @@ face_and_move_direction(rel_dir, distance)
}
}
-STATIC
+STATIC void
attack(rel_dir, itemp)
int rel_dir;
struct item *itemp;
@@ -446,7 +459,7 @@ attack(rel_dir, itemp)
}
}
-STATIC
+STATIC void
duck(rel_dir)
int rel_dir;
{
@@ -496,11 +509,11 @@ duck(rel_dir)
* go for the closest mine if possible
*/
-STATIC
+STATIC int
go_for_ammo(mine)
char mine;
{
- register int i, rel_dir, dist;
+ int i, rel_dir, dist;
rel_dir = -1;
dist = WIDTH;
@@ -523,10 +536,10 @@ go_for_ammo(mine)
return TRUE;
}
-STATIC
+STATIC void
wander()
{
- register int i, j, rel_dir, dir_mask, dir_count;
+ int i, j, rel_dir, dir_mask, dir_count;
for (i = 0; i < NUMDIRECTIONS; i++)
if (!(flbr[i].flags & BEEN) || flbr[i].distance <= 1)
diff --git a/hunt/hunt/playit.c b/hunt/hunt/playit.c
index 4a6046c9..e6776673 100644
--- a/hunt/hunt/playit.c
+++ b/hunt/hunt/playit.c
@@ -1,18 +1,25 @@
+/* $NetBSD: playit.c,v 1.2 1997/10/10 16:32:43 lukem Exp $ */
/*
* Hunt
* Copyright (c) 1985 Conrad C. Huang, Gregory S. Couch, Kenneth C.R.C. Arnold
* San Francisco, California
*/
-# if defined(HPUX) || (defined(BSD_RELEASE) && BSD_RELEASE >= 44)
-# include <termios.h>
-# endif
+#include <sys/cdefs.h>
+#ifndef lint
+__RCSID("$NetBSD: playit.c,v 1.2 1997/10/10 16:32:43 lukem Exp $");
+#endif /* not lint */
+
+# include <sys/file.h>
+# include <errno.h>
# include <curses.h>
# include <ctype.h>
# include <signal.h>
-# include <errno.h>
+# if defined(HPUX) || (defined(BSD_RELEASE) && BSD_RELEASE >= 44)
+# include <termios.h>
+# include <unistd.h>
+# endif
# include "hunt.h"
-# include <sys/file.h>
# ifndef FREAD
# define FREAD 1
@@ -31,9 +38,7 @@
# define put_str addstr
# endif
-int input();
static int nchar_send;
-static int in = FREAD;
# ifndef USE_CURSES
char screen[SCREEN_HEIGHT][SCREEN_WIDTH2], blanks[SCREEN_WIDTH];
int cur_row, cur_col;
@@ -55,7 +60,6 @@ static char otto_face;
*/
static int icnt = 0;
static unsigned char ibuf[256], *iptr = ibuf;
-static unsigned char getchr();
#define GETCHR() (--icnt < 0 ? getchr() : *iptr++)
@@ -63,16 +67,19 @@ static unsigned char getchr();
extern int _putchar();
#endif
+static unsigned char getchr __P((void));
+static void send_stuff __P((void));
+
/*
* playit:
* Play a given game, handling all the curses commands from
* the driver.
*/
+void
playit()
{
- register int ch;
- register int y, x;
- extern int errno;
+ int ch;
+ int y, x;
long version;
if (read(Socket, (char *) &version, LONGLEN) != LONGLEN) {
@@ -206,17 +213,14 @@ out:
* When this routine is called by GETCHR, we already know there are
* no characters in the input buffer.
*/
-static
-unsigned char
+static unsigned char
getchr()
{
- long readfds, s_readfds;
- int driver_mask, stdin_mask;
+ fd_set readfds, s_readfds;
int nfds, s_nfds;
- driver_mask = 1L << Socket;
- stdin_mask = 1L << STDIN;
- s_readfds = driver_mask | stdin_mask;
+ FD_SET(Socket, &s_readfds);
+ FD_SET(STDIN, &s_readfds);
s_nfds = (Socket > STDIN) ? Socket : STDIN;
s_nfds++;
@@ -228,9 +232,9 @@ one_more_time:
nfds = select(nfds, &readfds, NULL, NULL, NULL);
} while (nfds <= 0 && errno == EINTR);
- if (readfds & stdin_mask)
+ if (FD_ISSET(STDIN, &readfds))
send_stuff();
- if ((readfds & driver_mask) == 0)
+ if (! FD_ISSET(Socket, &readfds))
goto one_more_time;
icnt = read(Socket, ibuf, sizeof ibuf);
if (icnt < 0) {
@@ -248,10 +252,11 @@ one_more_time:
* send_stuff:
* Send standard input characters to the driver
*/
+static void
send_stuff()
{
- register int count;
- register char *sp, *nsp;
+ int count;
+ char *sp, *nsp;
static char inp[sizeof Buf];
count = read(STDIN, Buf, sizeof Buf);
@@ -270,8 +275,8 @@ send_stuff()
Buf[count] = '\0';
nsp = inp;
for (sp = Buf; *sp != '\0'; sp++)
- if ((*nsp = map_key[*sp]) == 'q')
- intr();
+ if ((*nsp = map_key[(int)*sp]) == 'q')
+ intr(0);
else
nsp++;
count = nsp - inp;
@@ -290,11 +295,11 @@ send_stuff()
* quit:
* Handle the end of the game when the player dies
*/
-long
+int
quit(old_status)
-long old_status;
+ int old_status;
{
- register int explain, ch;
+ int explain, ch;
if (Last_player)
return Q_QUIT;
@@ -468,6 +473,7 @@ get_message:
}
# ifndef USE_CURSES
+void
put_ch(ch)
char ch;
{
@@ -486,6 +492,7 @@ put_ch(ch)
}
}
+void
put_str(s)
char *s;
{
@@ -494,6 +501,7 @@ put_str(s)
}
# endif
+void
clear_the_screen()
{
# ifdef USE_CURSES
@@ -501,7 +509,7 @@ clear_the_screen()
move(0, 0);
refresh();
# else
- register int i;
+ int i;
if (blanks[0] == '\0')
for (i = 0; i < SCREEN_WIDTH; i++)
@@ -529,6 +537,7 @@ clear_the_screen()
}
#ifndef USE_CURSES
+void
clear_eol()
{
if (CE != NULL)
@@ -550,13 +559,14 @@ clear_eol()
}
# endif
+void
redraw_screen()
{
# ifdef USE_CURSES
clearok(stdscr, TRUE);
touchwin(stdscr);
# else
- register int i;
+ int i;
# ifndef NOCURSES
static int first = 1;
@@ -574,7 +584,8 @@ redraw_screen()
}
# if defined(BSD_RELEASE) && BSD_RELEASE >= 44
for (i = 0; i < SCREEN_HEIGHT; i++) {
- register int j;
+ int j;
+
for (j = 0; j < SCREEN_WIDTH; j++)
curscr->lines[i]->line[j].ch = screen[i][j];
}
@@ -605,10 +616,10 @@ redraw_screen()
* do_message:
* Send a message to the driver and return
*/
+void
do_message()
{
- extern int errno;
- long version;
+ long version;
if (read(Socket, (char *) &version, LONGLEN) != LONGLEN) {
bad_con();
diff --git a/hunt/huntd/answer.c b/hunt/huntd/answer.c
index fe8e2376..c78fcea2 100644
--- a/hunt/huntd/answer.c
+++ b/hunt/huntd/answer.c
@@ -1,22 +1,31 @@
+/* $NetBSD: answer.c,v 1.3 1997/10/10 16:32:50 lukem Exp $ */
/*
* Hunt
* Copyright (c) 1985 Conrad C. Huang, Gregory S. Couch, Kenneth C.R.C. Arnold
* San Francisco, California
*/
-# include "hunt.h"
+#include <sys/cdefs.h>
+#ifndef lint
+__RCSID("$NetBSD: answer.c,v 1.3 1997/10/10 16:32:50 lukem Exp $");
+#endif /* not lint */
+
# include <ctype.h>
# include <errno.h>
# include <fcntl.h>
+# include <stdlib.h>
+# include <unistd.h>
+# include "hunt.h"
# define SCOREDECAY 15
static char Ttyname[NAMELEN];
+int
answer()
{
- register PLAYER *pp;
- register int newsock;
+ PLAYER *pp;
+ int newsock;
static u_long mode;
static char name[NAMELEN];
static char team;
@@ -25,7 +34,7 @@ answer()
static u_long machine;
static u_long uid;
static SOCKET sockstruct;
- register char *cp1, *cp2;
+ char *cp1, *cp2;
int flags;
long version;
@@ -143,8 +152,7 @@ answer()
pp->p_output = fdopen(newsock, "w");
pp->p_death[0] = '\0';
pp->p_fd = newsock;
- pp->p_mask = (1 << pp->p_fd);
- Fds_mask |= pp->p_mask;
+ FD_SET(pp->p_fd, &Fds_mask);
if (pp->p_fd >= Num_fds)
Num_fds = pp->p_fd + 1;
@@ -161,11 +169,12 @@ answer()
}
# ifdef MONITOR
+void
stmonitor(pp)
-register PLAYER *pp;
+ PLAYER *pp;
{
- register int line;
- register PLAYER *npp;
+ int line;
+ PLAYER *npp;
memcpy(pp->p_maze, Maze, sizeof Maze);
@@ -189,12 +198,13 @@ register PLAYER *pp;
}
# endif
+void
stplayer(newpp, enter_status)
-register PLAYER *newpp;
-int enter_status;
+ PLAYER *newpp;
+ int enter_status;
{
- register int x, y;
- register PLAYER *pp;
+ int x, y;
+ PLAYER *pp;
Nplayer++;
@@ -315,6 +325,7 @@ int enter_status;
* rand_dir:
* Return a random direction
*/
+int
rand_dir()
{
switch (rand_num(4)) {
@@ -328,6 +339,7 @@ rand_dir()
return ABOVE;
}
/* NOTREACHED */
+ return(-1);
}
/*
@@ -336,12 +348,12 @@ rand_dir()
*/
IDENT *
get_ident(machine, uid, name, team)
-u_long machine;
-u_long uid;
-char *name;
-char team;
+ u_long machine;
+ u_long uid;
+ char *name;
+ char team;
{
- register IDENT *ip;
+ IDENT *ip;
static IDENT punt;
for (ip = Scores; ip != NULL; ip = ip->i_next)
diff --git a/hunt/huntd/ctl.c b/hunt/huntd/ctl.c
index 59449930..b7066f65 100644
--- a/hunt/huntd/ctl.c
+++ b/hunt/huntd/ctl.c
@@ -1,3 +1,4 @@
+/* $NetBSD: ctl.c,v 1.2 1997/10/10 16:32:54 lukem Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
@@ -8,9 +9,14 @@
#if defined(TALK_43) || defined(TALK_42)
+#include <sys/cdefs.h>
#ifndef lint
+#if 0
static char sccsid[] = "@(#)ctl.c 5.2 (Berkeley) 3/13/86";
+#else
+__RCSID("$NetBSD: ctl.c,v 1.2 1997/10/10 16:32:54 lukem Exp $");
#endif
+#endif /* not lint */
/*
* This file handles haggling with the various talk daemons to
@@ -18,6 +24,7 @@ static char sccsid[] = "@(#)ctl.c 5.2 (Berkeley) 3/13/86";
* the progress
*/
+#include "hunt.h"
#include "talk_ctl.h"
struct sockaddr_in daemon_addr = { AF_INET };
@@ -34,6 +41,7 @@ int ctl_sockt;
CTL_MSG msg;
/* open the ctl socket */
+void
open_ctl()
{
int length;
diff --git a/hunt/huntd/ctl_transact.c b/hunt/huntd/ctl_transact.c
index 1f23c487..cfbe0e65 100644
--- a/hunt/huntd/ctl_transact.c
+++ b/hunt/huntd/ctl_transact.c
@@ -1,3 +1,4 @@
+/* $NetBSD: ctl_transact.c,v 1.2 1997/10/10 16:33:01 lukem Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
@@ -8,12 +9,19 @@
#if defined(TALK_43) || defined(TALK_42)
+#include <sys/cdefs.h>
#ifndef lint
+#if 0
static char sccsid[] = "@(#)ctl_transact.c 5.2 (Berkeley) 3/13/86";
+#else
+__RCSID("$NetBSD: ctl_transact.c,v 1.2 1997/10/10 16:33:01 lukem Exp $");
#endif
+#endif /* not lint */
-#include "talk_ctl.h"
#include <sys/time.h>
+#include <unistd.h>
+#include "hunt.h"
+#include "talk_ctl.h"
#define CTL_WAIT 2 /* time to wait for a response, in seconds */
#define MAX_RETRY 5
@@ -23,19 +31,22 @@ static char sccsid[] = "@(#)ctl_transact.c 5.2 (Berkeley) 3/13/86";
* not recieved an acknowledgement within a reasonable amount
* of time
*/
+void
ctl_transact(target, msg, type, rp)
struct in_addr target;
CTL_MSG msg;
int type;
CTL_RESPONSE *rp;
{
- int read_mask, ctl_mask, nready, cc, retries;
+ fd_set read_mask, ctl_mask;
+ int nready, cc, retries;
struct timeval wait;
+ nready = 0;
msg.type = type;
daemon_addr.sin_addr = target;
daemon_addr.sin_port = daemon_port;
- ctl_mask = 1 << ctl_sockt;
+ FD_SET(ctl_sockt, &ctl_mask);
/*
* Keep sending the message until a response of
diff --git a/hunt/huntd/draw.c b/hunt/huntd/draw.c
index bbadbe16..ee53641c 100644
--- a/hunt/huntd/draw.c
+++ b/hunt/huntd/draw.c
@@ -1,18 +1,25 @@
+/* $NetBSD: draw.c,v 1.2 1997/10/10 16:33:04 lukem Exp $ */
/*
* Hunt
* Copyright (c) 1985 Conrad C. Huang, Gregory S. Couch, Kenneth C.R.C. Arnold
* San Francisco, California
*/
+#include <sys/cdefs.h>
+#ifndef lint
+__RCSID("$NetBSD: draw.c,v 1.2 1997/10/10 16:33:04 lukem Exp $");
+#endif /* not lint */
+
# include "hunt.h"
+void
drawmaze(pp)
-register PLAYER *pp;
+ PLAYER *pp;
{
- register int x;
- register char *sp;
- register int y;
- register char *endp;
+ int x;
+ char *sp;
+ int y;
+ char *endp;
clrscr(pp);
outstr(pp, pp->p_maze[0], WIDTH);
@@ -38,11 +45,12 @@ register PLAYER *pp;
* drawstatus - put up the status lines (this assumes the screen
* size is 80x24 with the maze being 64x24)
*/
+void
drawstatus(pp)
-register PLAYER *pp;
+ PLAYER *pp;
{
- register int i;
- register PLAYER *np;
+ int i;
+ PLAYER *np;
cgoto(pp, STAT_AMMO_ROW, STAT_LABEL_COL);
outstr(pp, "Ammo:", 5);
@@ -89,10 +97,11 @@ register PLAYER *pp;
# endif
}
+void
look(pp)
-register PLAYER *pp;
+ PLAYER *pp;
{
- register int x, y;
+ int x, y;
x = pp->p_x;
y = pp->p_y;
@@ -136,12 +145,13 @@ register PLAYER *pp;
cgoto(pp, y, x);
}
+void
see(pp, face)
-register PLAYER *pp;
-int face;
+ PLAYER *pp;
+ int face;
{
- register char *sp;
- register int y, x, i, cnt;
+ char *sp;
+ int y, x, i, cnt;
x = pp->p_x;
y = pp->p_y;
@@ -149,7 +159,7 @@ int face;
switch (face) {
case LEFTS:
sp = &Maze[y][x];
- for (i = 0; See_over[*--sp]; i++)
+ for (i = 0; See_over[(int)*--sp]; i++)
continue;
if (i == 0)
@@ -173,7 +183,7 @@ int face;
break;
case RIGHT:
sp = &Maze[y][++x];
- for (i = 0; See_over[*sp++]; i++)
+ for (i = 0; See_over[(int)*sp++]; i++)
continue;
if (i == 0)
@@ -197,7 +207,7 @@ int face;
break;
case ABOVE:
sp = &Maze[--y][x];
- if (!See_over[*sp])
+ if (!See_over[(int)*sp])
break;
do {
--y;
@@ -205,11 +215,11 @@ int face;
check(pp, y, x - 1);
check(pp, y, x );
check(pp, y, x + 1);
- } while (See_over[*sp]);
+ } while (See_over[(int)*sp]);
break;
case BELOW:
sp = &Maze[++y][x];
- if (!See_over[*sp])
+ if (!See_over[(int)*sp])
break;
do {
y++;
@@ -217,18 +227,19 @@ int face;
check(pp, y, x - 1);
check(pp, y, x );
check(pp, y, x + 1);
- } while (See_over[*sp]);
+ } while (See_over[(int)*sp]);
break;
}
}
+void
check(pp, y, x)
-PLAYER *pp;
-int y, x;
+ PLAYER *pp;
+ int y, x;
{
- register int index;
- register int ch;
- register PLAYER *rpp;
+ int index;
+ int ch;
+ PLAYER *rpp;
index = y * sizeof Maze[0] + x;
ch = ((char *) Maze)[index];
@@ -249,12 +260,13 @@ int y, x;
* showstat
* Update the status of players
*/
+void
showstat(pp)
-register PLAYER *pp;
+ PLAYER *pp;
{
- register PLAYER *np;
- register int y;
- register char c;
+ PLAYER *np;
+ int y;
+ char c;
y = STAT_PLAY_ROW + 1 + (pp - Player);
c = stat_char(pp);
@@ -275,12 +287,13 @@ register PLAYER *pp;
* Draw the player on the screen and show him to everyone who's scanning
* unless he is cloaked.
*/
+void
drawplayer(pp, draw)
-PLAYER *pp;
-FLAG draw;
+ PLAYER *pp;
+ FLAG draw;
{
- register PLAYER *newp;
- register int x, y;
+ PLAYER *newp;
+ int x, y;
x = pp->p_x;
y = pp->p_y;
@@ -312,9 +325,10 @@ FLAG draw;
showstat(pp);
}
+void
message(pp, s)
-register PLAYER *pp;
-char *s;
+ PLAYER *pp;
+ char *s;
{
cgoto(pp, HEIGHT, 0);
outstr(pp, s, strlen(s));
@@ -326,8 +340,9 @@ char *s;
* Turn a character into the right direction character if we are
* looking at the current player.
*/
+char
translate(ch)
-char ch;
+ char ch;
{
switch (ch) {
case LEFTS:
@@ -346,11 +361,12 @@ char ch;
* player_sym:
* Return the player symbol
*/
+int
player_sym(pp, y, x)
-PLAYER *pp;
-int y, x;
+ PLAYER *pp;
+ int y, x;
{
- register PLAYER *npp;
+ PLAYER *npp;
npp = play_at(y, x);
if (npp->p_ident->i_team == ' ')
diff --git a/hunt/huntd/driver.c b/hunt/huntd/driver.c
index f7f0c9d6..1f3b47a3 100644
--- a/hunt/huntd/driver.c
+++ b/hunt/huntd/driver.c
@@ -1,14 +1,24 @@
+/* $NetBSD: driver.c,v 1.2 1997/10/10 16:33:08 lukem Exp $ */
/*
* Hunt
* Copyright (c) 1985 Conrad C. Huang, Gregory S. Couch, Kenneth C.R.C. Arnold
* San Francisco, California
*/
-# include "hunt.h"
-# include <signal.h>
-# include <errno.h>
+#include <sys/cdefs.h>
+#ifndef lint
+__RCSID("$NetBSD: driver.c,v 1.2 1997/10/10 16:33:08 lukem Exp $");
+#endif /* not lint */
+
# include <sys/ioctl.h>
+# include <sys/stat.h>
# include <sys/time.h>
+# include <err.h>
+# include <errno.h>
+# include <signal.h>
+# include <stdlib.h>
+# include <unistd.h>
+# include "hunt.h"
# ifndef pdp11
# define RN (((Seed = Seed * 11109 + 13849) >> 16) & 0xffff)
@@ -33,26 +43,33 @@ u_short stat_port; /* port # of statistics tcp socket */
# define DAEMON_SIZE (sizeof Daemon - 1)
# endif
-extern SIGNAL_TYPE cleanup();
+static void clear_scores __P((void));
+static int havechar __P((PLAYER *));
+static void init __P((void));
+ int main __P((int, char *[], char *[]));
+static void makeboots __P((void));
+static void send_stats __P((void));
+static void zap __P((PLAYER *, FLAG));
+
/*
* main:
* The main program.
*/
+int
main(ac, av, ep)
-int ac;
-char **av, **ep;
+ int ac;
+ char **av, **ep;
{
- register PLAYER *pp;
- register int had_char;
+ PLAYER *pp;
+ int had_char;
# ifdef INTERNET
- register long test_mask;
- u_short msg;
- short port_num, reply;
- int namelen;
- SOCKET test;
+ u_short msg;
+ short port_num, reply;
+ int namelen;
+ SOCKET test;
# endif
- static long read_fds;
+ static fd_set read_fds;
static FLAG first = TRUE;
static FLAG server = FALSE;
extern int optind;
@@ -67,7 +84,7 @@ char **av, **ep;
ep++;
Last_arg = ep[-1] + strlen(ep[-1]);
- while ((c = getopt(ac, av, "sp:")) != EOF) {
+ while ((c = getopt(ac, av, "sp:")) != -1) {
switch (c) {
case 's':
server = TRUE;
@@ -88,19 +105,13 @@ erred:
goto erred;
init();
- Sock_mask = (1 << Socket);
- Stat_mask = (1 << Status);
-# ifdef INTERNET
- test_mask = (1 << Test_socket);
-# endif
again:
do {
read_fds = Fds_mask;
errno = 0;
- while (select(Num_fds, &read_fds, (int *) NULL,
- (int *) NULL, (struct timeval *) NULL) < 0)
+ while (select(Num_fds, &read_fds, NULL, NULL, NULL) < 0)
{
if (errno != EINTR)
# ifdef LOG
@@ -112,7 +123,7 @@ again:
}
Have_inp = read_fds;
# ifdef INTERNET
- if (read_fds & test_mask) {
+ if (FD_ISSET(Test_socket, &read_fds)) {
namelen = DAEMON_SIZE;
port_num = htons(sock_port);
(void) recvfrom(Test_socket, (char *) &msg, sizeof msg,
@@ -176,7 +187,7 @@ again:
pp++;
# endif
}
- if (read_fds & Sock_mask)
+ if (FD_ISSET(Socket, &read_fds))
if (answer()) {
# ifdef INTERNET
if (first && standard_port)
@@ -184,17 +195,17 @@ again:
# endif
first = FALSE;
}
- if (read_fds & Stat_mask)
+ if (FD_ISSET(Status, &read_fds))
send_stats();
for (pp = Player; pp < End_player; pp++) {
- if (read_fds & pp->p_mask)
+ if (FD_ISSET(pp->p_fd, &read_fds))
sendcom(pp, READY, pp->p_nexec);
pp->p_nexec = 0;
(void) fflush(pp->p_output);
}
# ifdef MONITOR
for (pp = Monitor; pp < End_monitor; pp++) {
- if (read_fds & pp->p_mask)
+ if (FD_ISSET(pp->p_fd, &read_fds))
sendcom(pp, READY, pp->p_nexec);
pp->p_nexec = 0;
(void) fflush(pp->p_output);
@@ -203,8 +214,7 @@ again:
} while (Nplayer > 0);
read_fds = Fds_mask;
- if (select(Num_fds, &read_fds, (int *) NULL, (int *) NULL,
- &linger) > 0) {
+ if (select(Num_fds, &read_fds, NULL, NULL, &linger) > 0) {
goto again;
}
if (server) {
@@ -223,19 +233,22 @@ again:
zap(pp, FALSE);
# endif
cleanup(0);
+ /* NOTREACHED */
+ return(0);
}
/*
* init:
* Initialize the global parameters.
*/
+static void
init()
{
- register int i;
+ int i;
# ifdef INTERNET
- auto SOCKET test_port;
- auto int msg;
- auto int len;
+ SOCKET test_port;
+ int msg;
+ int len;
# endif
# ifndef DEBUG
@@ -354,7 +367,8 @@ init()
/*
* Initialize minimal select mask
*/
- Fds_mask = (1 << Socket) | (1 << Status);
+ FD_SET(Socket, &Fds_mask);
+ FD_SET(Status, &Fds_mask);
Num_fds = ((Socket > Status) ? Socket : Status) + 1;
# ifdef INTERNET
@@ -384,7 +398,7 @@ init()
(void) listen(Test_socket, 5);
}
- Fds_mask |= (1 << Test_socket);
+ FD_SET(Test_socket, &Fds_mask);
if (Test_socket + 1 > Num_fds)
Num_fds = Test_socket + 1;
# endif
@@ -413,10 +427,11 @@ init()
* makeboots:
* Put the boots in the maze
*/
+static void
makeboots()
{
- register int x, y;
- register PLAYER *pp;
+ int x, y;
+ PLAYER *pp;
do {
x = rand_num(WIDTH - 1) + 1;
@@ -433,13 +448,14 @@ makeboots()
* checkdam:
* Check the damage to the given player, and see if s/he is killed
*/
+void
checkdam(ouch, gotcha, credit, amt, shot_type)
-register PLAYER *ouch, *gotcha;
-register IDENT *credit;
-int amt;
-char shot_type;
+ PLAYER *ouch, *gotcha;
+ IDENT *credit;
+ int amt;
+ char shot_type;
{
- register char *cp;
+ char *cp;
if (ouch->p_death[0] != '\0')
return;
@@ -566,15 +582,16 @@ char shot_type;
* zap:
* Kill off a player and take him out of the game.
*/
+static void
zap(pp, was_player)
-register PLAYER *pp;
-FLAG was_player;
+ PLAYER *pp;
+ FLAG was_player;
{
- register int i, len;
- register BULLET *bp;
- register PLAYER *np;
- register int x, y;
- int savefd, savemask;
+ int i, len;
+ BULLET *bp;
+ PLAYER *np;
+ int x, y;
+ int savefd;
if (was_player) {
if (pp->p_undershot)
@@ -598,7 +615,6 @@ FLAG was_player;
cgoto(pp, HEIGHT, 0);
savefd = pp->p_fd;
- savemask = pp->p_mask;
# ifdef MONITOR
if (was_player) {
@@ -653,7 +669,7 @@ FLAG was_player;
if (np->p_flying < 0)
break;
if (np >= &Boot[NBOOTS])
- abort(1, "Too many boots");
+ err(1, "Too many boots");
np->p_undershot = FALSE;
np->p_x = pp->p_x;
np->p_y = pp->p_y;
@@ -776,7 +792,7 @@ FLAG was_player;
}
# endif
- Fds_mask &= ~savemask;
+ FD_CLR(savefd, &Fds_mask);
if (Num_fds == savefd + 1) {
Num_fds = Socket;
# ifdef INTERNET
@@ -799,8 +815,9 @@ FLAG was_player;
* rand_num:
* Return a random number in a given range.
*/
+int
rand_num(range)
-int range;
+ int range;
{
return (range == 0 ? 0 : RN % range);
}
@@ -811,16 +828,16 @@ int range;
* we do, read them, stash them away, and return TRUE; else return
* FALSE.
*/
+static int
havechar(pp)
-register PLAYER *pp;
+ PLAYER *pp;
{
- extern int errno;
if (pp->p_ncount < pp->p_nchar)
return TRUE;
- if (!(Have_inp & pp->p_mask))
+ if (!FD_ISSET(pp->p_fd, &Have_inp))
return FALSE;
- Have_inp &= ~pp->p_mask;
+ FD_CLR(pp->p_fd, &Have_inp);
check_again:
errno = 0;
if ((pp->p_nchar = read(pp->p_fd, pp->p_cbuf, sizeof pp->p_cbuf)) <= 0)
@@ -839,9 +856,9 @@ check_again:
*/
SIGNAL_TYPE
cleanup(eval)
-int eval;
+ int eval;
{
- register PLAYER *pp;
+ PLAYER *pp;
for (pp = Player; pp < End_player; pp++) {
cgoto(pp, HEIGHT, 0);
@@ -869,13 +886,14 @@ int eval;
* send_stats:
* Print stats to requestor
*/
+static void
send_stats()
{
- register IDENT *ip;
- register FILE *fp;
- int s;
- SOCKET sockstruct;
- int socklen;
+ IDENT *ip;
+ FILE *fp;
+ int s;
+ SOCKET sockstruct;
+ int socklen;
/*
* Get the output stream ready
@@ -944,9 +962,10 @@ send_stats()
* clear_scores:
* Clear out the scores so the next session start clean
*/
+static void
clear_scores()
{
- register IDENT *ip, *nextip;
+ IDENT *ip, *nextip;
for (ip = Scores; ip != NULL; ip = nextip) {
nextip = ip->i_next;
diff --git a/hunt/huntd/execute.c b/hunt/huntd/execute.c
index c961d486..30046448 100644
--- a/hunt/huntd/execute.c
+++ b/hunt/huntd/execute.c
@@ -1,20 +1,37 @@
+/* $NetBSD: execute.c,v 1.2 1997/10/10 16:33:13 lukem Exp $ */
/*
* Hunt
* Copyright (c) 1985 Conrad C. Huang, Gregory S. Couch, Kenneth C.R.C. Arnold
* San Francisco, California
*/
+#include <sys/cdefs.h>
+#ifndef lint
+__RCSID("$NetBSD: execute.c,v 1.2 1997/10/10 16:33:13 lukem Exp $");
+#endif /* not lint */
+
+# include <stdlib.h>
# include "hunt.h"
+static void cloak __P((PLAYER *));
+static void face __P((PLAYER *, int));
+static void fire __P((PLAYER *, int));
+static void fire_slime __P((PLAYER *, int));
+static void move_player __P((PLAYER *, int));
+static void pickup __P((PLAYER *, int, int, int, int));
+static void scan __P((PLAYER *));
+
+
# ifdef MONITOR
/*
* mon_execute:
* Execute a single monitor command
*/
+void
mon_execute(pp)
-register PLAYER *pp;
+ PLAYER *pp;
{
- register char ch;
+ char ch;
ch = pp->p_cbuf[pp->p_ncount++];
switch (ch) {
@@ -32,10 +49,11 @@ register PLAYER *pp;
* execute:
* Execute a single command
*/
+void
execute(pp)
-register PLAYER *pp;
+ PLAYER *pp;
{
- register char ch;
+ char ch;
ch = pp->p_cbuf[pp->p_ncount++];
@@ -148,14 +166,15 @@ register PLAYER *pp;
* move_player:
* Execute a move in the given direction
*/
+static void
move_player(pp, dir)
-register PLAYER *pp;
-int dir;
+ PLAYER *pp;
+ int dir;
{
- register PLAYER *newp;
- register int x, y;
- register FLAG moved;
- register BULLET *bp;
+ PLAYER *newp;
+ int x, y;
+ FLAG moved;
+ BULLET *bp;
y = pp->p_y;
x = pp->p_x;
@@ -283,9 +302,10 @@ int dir;
* face:
* Change the direction the player is facing
*/
+static void
face(pp, dir)
-register PLAYER *pp;
-register int dir;
+ PLAYER *pp;
+ int dir;
{
if (pp->p_face != dir) {
pp->p_face = dir;
@@ -297,9 +317,10 @@ register int dir;
* fire:
* Fire a shot of the given type in the given direction
*/
+static void
fire(pp, req_index)
-register PLAYER *pp;
-register int req_index;
+ PLAYER *pp;
+ int req_index;
{
if (pp == NULL)
return;
@@ -345,9 +366,10 @@ register int req_index;
* fire_slime:
* Fire a slime shot in the given direction
*/
+static void
fire_slime(pp, req_index)
-register PLAYER *pp;
-register int req_index;
+ PLAYER *pp;
+ int req_index;
{
if (pp == NULL)
return;
@@ -393,6 +415,7 @@ register int req_index;
* add_shot:
* Create a shot with the given properties
*/
+void
add_shot(type, y, x, face, charge, owner, expl, over)
int type;
int y, x;
@@ -402,8 +425,8 @@ PLAYER *owner;
int expl;
char over;
{
- register BULLET *bp;
- register int size;
+ BULLET *bp;
+ int size;
switch (type) {
case SHOT:
@@ -436,17 +459,17 @@ char over;
BULLET *
create_shot(type, y, x, face, charge, size, owner, score, expl, over)
-int type;
-int y, x;
-char face;
-int charge;
-int size;
-PLAYER *owner;
-IDENT *score;
-int expl;
-char over;
+ int type;
+ int y, x;
+ char face;
+ int charge;
+ int size;
+ PLAYER *owner;
+ IDENT *score;
+ int expl;
+ char over;
{
- register BULLET *bp;
+ BULLET *bp;
bp = (BULLET *) malloc(sizeof (BULLET)); /* NOSTRICT */
if (bp == NULL) {
@@ -474,8 +497,9 @@ char over;
* cloak:
* Turn on or increase length of a cloak
*/
+static void
cloak(pp)
-register PLAYER *pp;
+ PLAYER *pp;
{
if (pp->p_ammo <= 0) {
message(pp, "No more charges");
@@ -503,8 +527,9 @@ register PLAYER *pp;
* scan:
* Turn on or increase length of a scan
*/
+static void
scan(pp)
-register PLAYER *pp;
+ PLAYER *pp;
{
if (pp->p_ammo <= 0) {
message(pp, "No more charges");
@@ -526,13 +551,14 @@ register PLAYER *pp;
* pickup:
* check whether the object blew up or whether he picked it up
*/
+void
pickup(pp, y, x, prob, obj)
-register PLAYER *pp;
-register int y, x;
-int prob;
-int obj;
+ PLAYER *pp;
+ int y, x;
+ int prob;
+ int obj;
{
- register int req;
+ int req;
switch (obj) {
case MINE:
diff --git a/hunt/huntd/expl.c b/hunt/huntd/expl.c
index 59f7eee2..74a8f585 100644
--- a/hunt/huntd/expl.c
+++ b/hunt/huntd/expl.c
@@ -1,21 +1,32 @@
+/* $NetBSD: expl.c,v 1.2 1997/10/10 16:33:18 lukem Exp $ */
/*
* Hunt
* Copyright (c) 1985 Conrad C. Huang, Gregory S. Couch, Kenneth C.R.C. Arnold
* San Francisco, California
*/
+#include <sys/cdefs.h>
+#ifndef lint
+__RCSID("$NetBSD: expl.c,v 1.2 1997/10/10 16:33:18 lukem Exp $");
+#endif /* not lint */
+
+# include <stdlib.h>
# include "hunt.h"
+static void remove_wall __P((int, int));
+
+
/*
* showexpl:
* Show the explosions as they currently are
*/
+void
showexpl(y, x, type)
-register int y, x;
-char type;
+ int y, x;
+ char type;
{
- register PLAYER *pp;
- register EXPL *ep;
+ PLAYER *pp;
+ EXPL *ep;
if (y < 0 || y >= HEIGHT)
return;
@@ -69,13 +80,14 @@ char type;
* Roll the explosions over, so the next one in the list is at the
* top
*/
+void
rollexpl()
{
- register EXPL *ep;
- register PLAYER *pp;
- register int y, x;
- register char c;
- register EXPL *nextep;
+ EXPL *ep;
+ PLAYER *pp;
+ int y, x;
+ char c;
+ EXPL *nextep;
for (ep = Expl[EXPLEN - 1]; ep != NULL; ep = nextep) {
nextep = ep->e_next;
@@ -114,15 +126,16 @@ static REGEN *rem_index = removed;
* if there is no space left over, put the a wall at
* the location currently pointed at.
*/
+static void
remove_wall(y, x)
-int y, x;
+ int y, x;
{
- register REGEN *r;
+ REGEN *r;
# if defined(MONITOR) || defined(FLY)
- register PLAYER *pp;
+ PLAYER *pp;
# endif
# ifdef FLY
- register char save_char;
+ char save_char = 0;
# endif
r = rem_index;
@@ -201,9 +214,10 @@ found:
* clearwalls:
* Clear out the walls array
*/
+void
clearwalls()
{
- register REGEN *rp;
+ REGEN *rp;
for (rp = removed; rp < &removed[MAXREMOVE]; rp++)
rp->r_y = 0;
diff --git a/hunt/huntd/extern.c b/hunt/huntd/extern.c
index 64e5fccf..e25ba836 100644
--- a/hunt/huntd/extern.c
+++ b/hunt/huntd/extern.c
@@ -1,9 +1,15 @@
+/* $NetBSD: extern.c,v 1.2 1997/10/10 16:33:24 lukem Exp $ */
/*
* Hunt
* Copyright (c) 1985 Conrad C. Huang, Gregory S. Couch, Kenneth C.R.C. Arnold
* San Francisco, California
*/
+#include <sys/cdefs.h>
+#ifndef lint
+__RCSID("$NetBSD: extern.c,v 1.2 1997/10/10 16:33:24 lukem Exp $");
+#endif /* not lint */
+
# include "hunt.h"
# ifdef MONITOR
@@ -14,14 +20,12 @@ char Buf[BUFSIZ]; /* general scribbling buffer */
char Maze[HEIGHT][WIDTH2]; /* the maze */
char Orig_maze[HEIGHT][WIDTH2]; /* the original maze */
-long Fds_mask; /* mask for the file descriptors */
-int Have_inp; /* which file descriptors have input */
+fd_set Fds_mask; /* mask for the file descriptors */
+fd_set Have_inp; /* which file descriptors have input */
int Nplayer = 0; /* number of players */
int Num_fds; /* number of maximum file descriptor */
int Socket; /* main socket */
-long Sock_mask; /* select mask for main socket */
int Status; /* stat socket */
-long Stat_mask; /* select mask for stat socket */
int See_over[NASCII]; /* lookup table for determining whether
* character represents "transparent"
* item */
diff --git a/hunt/huntd/faketalk.c b/hunt/huntd/faketalk.c
index 48f17990..e594b12e 100644
--- a/hunt/huntd/faketalk.c
+++ b/hunt/huntd/faketalk.c
@@ -1,3 +1,4 @@
+/* $NetBSD: faketalk.c,v 1.3 1997/10/10 16:33:31 lukem Exp $ */
/*
* Hunt
* Copyright (c) 1985 Conrad C. Huang, Gregory S. Couch, Kenneth C.R.C. Arnold
@@ -8,18 +9,25 @@
* specifies the terms and conditions for redistribution.
*/
+#include <sys/cdefs.h>
+#ifndef lint
+__RCSID("$NetBSD: faketalk.c,v 1.3 1997/10/10 16:33:31 lukem Exp $");
+#endif /* not lint */
+
#include "bsd.h"
#if defined(TALK_43) || defined(TALK_42)
+# include <sys/time.h>
+# include <sys/wait.h>
+# include <ctype.h>
+# include <netdb.h>
+# include <signal.h>
# include <stdio.h>
# include <string.h>
-# include <netdb.h>
+# include <unistd.h>
+# include "hunt.h"
# include "talk_ctl.h"
-# include <ctype.h>
-# include <signal.h>
-# include <sys/time.h>
-extern int errno;
# define TRUE 1
# define FALSE 0
@@ -36,12 +44,16 @@ extern int errno;
extern char *my_machine_name;
extern char *First_arg, *Last_arg;
+static void do_announce __P((char *));
+SIGNAL_TYPE exorcise __P((int));
+
/*
* exorcise - disspell zombies
*/
SIGNAL_TYPE
-exorcise()
+exorcise(dummy)
+ int dummy;
{
(void) wait(0);
}
@@ -51,6 +63,7 @@ exorcise()
* and fake a talk request to each address thus found.
*/
+void
faketalk()
{
struct servent *sp;
@@ -171,6 +184,7 @@ faketalk()
* These are used to delete the invitations.
*/
+static void
do_announce(s)
char *s;
{
diff --git a/hunt/huntd/get_names.c b/hunt/huntd/get_names.c
index e8a101a0..2d1cbe4d 100644
--- a/hunt/huntd/get_names.c
+++ b/hunt/huntd/get_names.c
@@ -1,30 +1,36 @@
+/* $NetBSD: get_names.c,v 1.2 1997/10/10 16:33:35 lukem Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*/
+#include <sys/cdefs.h>
+#ifndef lint
+__RCSID("$NetBSD: get_names.c,v 1.2 1997/10/10 16:33:35 lukem Exp $");
+#endif /* not lint */
+
#include "bsd.h"
#if defined(TALK_43) || defined(TALK_42)
+# include <sys/param.h>
+# include <netdb.h>
# include <stdio.h>
# include <string.h>
+# include <unistd.h>
+# include "hunt.h"
# include "talk_ctl.h"
-# include <sys/param.h>
-# include <netdb.h>
extern CTL_MSG msg;
-struct hostent *gethostbyname();
-struct servent *getservbyname();
-
static char hostname[MAXHOSTNAMELEN];
char *my_machine_name;
/*
* Determine the local user and machine
*/
+void
get_local_name(my_name)
char *my_name;
{
@@ -75,6 +81,7 @@ get_local_name(my_name)
/*
* Determine the remote user and machine
*/
+int
get_remote_name(his_address)
char *his_address;
{
@@ -109,7 +116,7 @@ get_remote_name(his_address)
msg.r_name[NAME_SIZE - 1] = '\0';
/* if he is on the same machine, then simply copy */
- if (bcmp((char *) &his_machine_name, (char *) &my_machine_name,
+ if (memcmp((char *) &his_machine_name, (char *) &my_machine_name,
sizeof(his_machine_name)) == 0)
memcpy(&his_machine_addr, &my_machine_addr,
sizeof(his_machine_name));
diff --git a/hunt/huntd/hunt.h b/hunt/huntd/hunt.h
index 3225f44f..a48dc98d 100644
--- a/hunt/huntd/hunt.h
+++ b/hunt/huntd/hunt.h
@@ -345,8 +345,8 @@ extern char Buf[BUFSIZ], Maze[HEIGHT][WIDTH2], Orig_maze[HEIGHT][WIDTH2];
extern char *Sock_name, *Driver;
-extern int errno, Have_inp, Nplayer, Num_fds, Socket, Status;
-extern long Fds_mask, Sock_mask, Stat_mask;
+extern int errno, Nplayer, Num_fds, Socket, Status;
+extern fd_set Fds_mask, Have_inp;
# ifdef INTERNET
extern u_short Test_port;
@@ -388,13 +388,66 @@ extern FLAG no_beep;
* function types
*/
-extern char *getenv();
-extern void *malloc(), *realloc();
-
-extern IDENT *get_ident();
-
-extern int moveshots();
-
-extern BULLET *is_bullet(), *create_shot();
-
-extern PLAYER *play_at();
+void add_shot __P((int, int, int, char, int, PLAYER *, int, char));
+int answer __P((void));
+void bad_con __P((void));
+void bad_ver __P((void));
+int broadcast_vec __P((int, struct sockaddr **));
+void ce __P((PLAYER *));
+void cgoto __P((PLAYER *, int, int));
+void check __P((PLAYER *, int, int));
+void checkdam __P((PLAYER *, PLAYER *, IDENT *, int, char));
+void clearwalls __P((void));
+void clear_eol __P((void));
+void clear_the_screen __P((void));
+void clrscr __P((PLAYER *));
+BULLET *create_shot __P((int, int, int, char, int, int, PLAYER *,
+ IDENT *, int, char));
+void do_connect __P((char *, char, long));
+void do_message __P((void));
+void drawmaze __P((PLAYER *));
+void drawplayer __P((PLAYER *, FLAG));
+void drawstatus __P((PLAYER *));
+void execute __P((PLAYER *));
+void faketalk __P((void));
+void find_driver __P((FLAG));
+void fixshots __P((int, int, char));
+IDENT *get_ident __P((u_long, u_long, char *, char));
+void get_local_name __P((char *));
+int get_remote_name __P((char *));
+BULLET *is_bullet __P((int, int));
+void look __P((PLAYER *));
+void makemaze __P((void));
+void message __P((PLAYER *, char *));
+void mon_execute __P((PLAYER *));
+void moveshots __P((void));
+void open_ctl __P((void));
+int opposite __P((int, char));
+void otto __P((int, int, char));
+void outch __P((PLAYER *, int));
+void outstr __P((PLAYER *, char *, int));
+int player_sym __P((PLAYER *, int, int));
+PLAYER *play_at __P((int, int));
+void playit __P((void));
+void put_ch __P((char));
+void put_str __P((char *));
+int quit __P((int));
+int rand_dir __P((void));
+int rand_num __P((int));
+void redraw_screen __P((void));
+void rmnl __P((char *));
+void rollexpl __P((void));
+void see __P((PLAYER *, int));
+void sendcom __P((PLAYER *, int, ...));
+void showexpl __P((int, int, char));
+void showstat __P((PLAYER *));
+void start_driver __P((void));
+void stmonitor __P((PLAYER *));
+void stplayer __P((PLAYER *, int));
+char translate __P((char));
+SIGNAL_TYPE cleanup __P((int));
+SIGNAL_TYPE intr __P((int));
+SIGNAL_TYPE sigalrm __P((int));
+SIGNAL_TYPE sigemt __P((int));
+SIGNAL_TYPE sigterm __P((int));
+SIGNAL_TYPE tstp __P((int));
diff --git a/hunt/huntd/makemaze.c b/hunt/huntd/makemaze.c
index d0e88960..bcc21c61 100644
--- a/hunt/huntd/makemaze.c
+++ b/hunt/huntd/makemaze.c
@@ -1,18 +1,30 @@
+/* $NetBSD: makemaze.c,v 1.2 1997/10/10 16:33:43 lukem Exp $ */
/*
* Hunt
* Copyright (c) 1985 Conrad C. Huang, Gregory S. Couch, Kenneth C.R.C. Arnold
* San Francisco, California
*/
+#include <sys/cdefs.h>
+#ifndef lint
+__RCSID("$NetBSD: makemaze.c,v 1.2 1997/10/10 16:33:43 lukem Exp $");
+#endif /* not lint */
+
# include "hunt.h"
# define ISCLEAR(y,x) (Maze[y][x] == SPACE)
# define ODD(n) ((n) & 01)
+static int candig __P((int, int));
+static void dig __P((int, int));
+static void dig_maze __P((int, int));
+static void remap __P((void));
+
+void
makemaze()
{
- register char *sp;
- register int y, x;
+ char *sp;
+ int y, x;
/*
* fill maze with walls
@@ -43,13 +55,14 @@ int incr[NDIR][2] = {
{0, 1}, {1, 0}, {0, -1}, {-1, 0}
};
+static void
dig(y, x)
-int y, x;
+ int y, x;
{
- register int *dp;
- register int *ip;
- register int ny, nx;
- register int *endp;
+ int *dp;
+ int *ip;
+ int ny, nx;
+ int *endp;
Maze[y][x] = SPACE; /* Clear this spot */
dp = dirs[rand_num(NPERM)];
@@ -67,10 +80,11 @@ int y, x;
* candig:
* Is it legal to clear this spot?
*/
+static int
candig(y, x)
-register int y, x;
+ int y, x;
{
- register int i;
+ int i;
if (ODD(x) && ODD(y))
return FALSE; /* can't touch ODD spots */
@@ -97,17 +111,19 @@ register int y, x;
return TRUE; /* OK */
}
+void
dig_maze(x, y)
-int x, y;
+ int x, y;
{
- register int tx, ty;
- register int i, j;
- int order[4];
+ int tx, ty;
+ int i, j;
+ int order[4];
#define MNORTH 0x1
#define MSOUTH 0x2
#define MEAST 0x4
#define MWEST 0x8
+ tx = ty = 0;
Maze[y][x] = SPACE;
order[0] = MNORTH;
for (i = 1; i < 4; i++) {
@@ -143,11 +159,12 @@ int x, y;
}
}
+void
remap()
{
- register int y, x;
- register char *sp;
- register int stat;
+ int y, x;
+ char *sp;
+ int stat;
for (y = 0; y < HEIGHT; y++)
for (x = 0; x < WIDTH; x++) {
diff --git a/hunt/huntd/pathname.c b/hunt/huntd/pathname.c
index 90b4d380..0f909f78 100644
--- a/hunt/huntd/pathname.c
+++ b/hunt/huntd/pathname.c
@@ -1,9 +1,15 @@
+/* $NetBSD: pathname.c,v 1.2 1997/10/10 16:33:49 lukem Exp $ */
/*
* Hunt
* Copyright (c) 1985 Conrad C. Huang, Gregory S. Couch, Kenneth C.R.C. Arnold
* San Francisco, California
*/
+#include <sys/cdefs.h>
+#ifndef lint
+__RCSID("$NetBSD: pathname.c,v 1.2 1997/10/10 16:33:49 lukem Exp $");
+#endif /* not lint */
+
/*
* There is no particular significance to the numbers assigned
* to Test_port. They're just random numbers greater than the
diff --git a/hunt/huntd/shots.c b/hunt/huntd/shots.c
index 3aa7284c..d0dfcf90 100644
--- a/hunt/huntd/shots.c
+++ b/hunt/huntd/shots.c
@@ -1,25 +1,49 @@
+/* $NetBSD: shots.c,v 1.2 1997/10/10 16:33:54 lukem Exp $ */
/*
* Hunt
* Copyright (c) 1985 Conrad C. Huang, Gregory S. Couch, Kenneth C.R.C. Arnold
* San Francisco, California
*/
-# include "hunt.h"
+#include <sys/cdefs.h>
+#ifndef lint
+__RCSID("$NetBSD: shots.c,v 1.2 1997/10/10 16:33:54 lukem Exp $");
+#endif /* not lint */
+
# include <signal.h>
+# include <stdlib.h>
+# include "hunt.h"
# define PLUS_DELTA(x, max) if (x < max) x++; else x--
# define MINUS_DELTA(x, min) if (x > min) x--; else x++
+static void chkshot __P((BULLET *, BULLET *));
+static void chkslime __P((BULLET *, BULLET *));
+static void explshot __P((BULLET *, int, int));
+static void find_under __P((BULLET *, BULLET *));
+static int iswall __P((int, int));
+static void mark_boot __P((BULLET *));
+static void mark_player __P((BULLET *));
+#ifdef DRONE
+static void move_drone __P((BULLET *));
+#endif
+static void move_flyer __P((PLAYER *));
+static int move_normal_shot __P((BULLET *));
+static void move_slime __P((BULLET *, int, BULLET *));
+static void save_bullet __P((BULLET *));
+static void zapshot __P((BULLET *, BULLET *));
+
/*
* moveshots:
* Move the shots already in the air, taking explosions into account
*/
+void
moveshots()
{
- register BULLET *bp, *next;
- register PLAYER *pp;
- register int x, y;
- register BULLET *blist;
+ BULLET *bp, *next;
+ PLAYER *pp;
+ int x, y;
+ BULLET *blist;
rollexpl();
if (Bullets == NULL)
@@ -132,11 +156,12 @@ ret:
* move_normal_shot:
* Move a normal shot along its trajectory
*/
+static int
move_normal_shot(bp)
-register BULLET *bp;
+ BULLET *bp;
{
- register int i, x, y;
- register PLAYER *pp;
+ int i, x, y;
+ PLAYER *pp;
for (i = 0; i < BULSPD; i++) {
if (bp->b_expl)
@@ -318,12 +343,13 @@ register BULLET *bp;
* move_drone:
* Move the drone to the next square
*/
+static void
move_drone(bp)
-register BULLET *bp;
+ BULLET *bp;
{
- register int mask, count;
- register int n, dir;
- register PLAYER *pp;
+ int mask, count;
+ int n, dir;
+ PLAYER *pp;
/*
* See if we can give someone a blast
@@ -461,8 +487,9 @@ drone_move:
* save_bullet:
* Put this bullet back onto the bullet list
*/
+static void
save_bullet(bp)
-register BULLET *bp;
+ BULLET *bp;
{
bp->b_over = Maze[bp->b_y][bp->b_x];
switch (bp->b_over) {
@@ -512,10 +539,11 @@ register BULLET *bp;
* move_flyer:
* Update the position of a player in flight
*/
+static void
move_flyer(pp)
-register PLAYER *pp;
+ PLAYER *pp;
{
- register int x, y;
+ int x, y;
if (pp->p_undershot) {
fixshots(pp->p_y, pp->p_x, pp->p_over);
@@ -602,16 +630,18 @@ again:
* chkshot
* Handle explosions
*/
+static void
chkshot(bp, next)
-register BULLET *bp;
-BULLET *next;
+ BULLET *bp;
+ BULLET *next;
{
- register int y, x;
- register int dy, dx, absdy;
- register int delta, damage;
- register char expl;
- register PLAYER *pp;
+ int y, x;
+ int dy, dx, absdy;
+ int delta, damage;
+ char expl;
+ PLAYER *pp;
+ delta = 0;
switch (bp->b_type) {
case SHOT:
case MINE:
@@ -694,11 +724,12 @@ BULLET *next;
* chkslime:
* handle slime shot exploding
*/
+static void
chkslime(bp, next)
-register BULLET *bp;
-BULLET *next;
+ BULLET *bp;
+ BULLET *next;
{
- register BULLET *nbp;
+ BULLET *nbp;
switch (Maze[bp->b_y][bp->b_x]) {
case WALL1:
@@ -741,14 +772,15 @@ BULLET *next;
* move the given slime shot speed times and add it back if
* it hasn't fizzled yet
*/
+void
move_slime(bp, speed, next)
-register BULLET *bp;
-register int speed;
-BULLET *next;
+ BULLET *bp;
+ int speed;
+ BULLET *next;
{
- register int i, j, dirmask, count;
- register PLAYER *pp;
- register BULLET *nbp;
+ int i, j, dirmask, count;
+ PLAYER *pp;
+ BULLET *nbp;
if (speed == 0) {
if (bp->b_charge <= 0)
@@ -900,8 +932,9 @@ BULLET *next;
* iswall:
* returns whether the given location is a wall
*/
+static int
iswall(y, x)
-register int y, x;
+ int y, x;
{
if (y < 0 || x < 0 || y >= HEIGHT || x >= WIDTH)
return TRUE;
@@ -932,11 +965,12 @@ register int y, x;
* zapshot:
* Take a shot out of the air.
*/
+static void
zapshot(blist, obp)
-register BULLET *blist, *obp;
+ BULLET *blist, *obp;
{
- register BULLET *bp;
- register FLAG explode;
+ BULLET *bp;
+ FLAG explode;
explode = FALSE;
for (bp = blist; bp != NULL; bp = bp->b_next) {
@@ -956,11 +990,12 @@ register BULLET *blist, *obp;
* explshot -
* Make all shots at this location blow up
*/
+void
explshot(blist, y, x)
-register BULLET *blist;
-register int y, x;
+ BULLET *blist;
+ int y, x;
{
- register BULLET *bp;
+ BULLET *bp;
for (bp = blist; bp != NULL; bp = bp->b_next)
if (bp->b_x == x && bp->b_y == y) {
@@ -976,9 +1011,9 @@ register int y, x;
*/
PLAYER *
play_at(y, x)
-register int y, x;
+ int y, x;
{
- register PLAYER *pp;
+ PLAYER *pp;
for (pp = Player; pp < End_player; pp++)
if (pp->p_x == x && pp->p_y == y)
@@ -993,9 +1028,10 @@ register int y, x;
* Return TRUE if the bullet direction faces the opposite direction
* of the player in the maze
*/
+int
opposite(face, dir)
-int face;
-char dir;
+ int face;
+ char dir;
{
switch (face) {
case LEFTS:
@@ -1018,9 +1054,9 @@ char dir;
*/
BULLET *
is_bullet(y, x)
-register int y, x;
+ int y, x;
{
- register BULLET *bp;
+ BULLET *bp;
for (bp = Bullets; bp != NULL; bp = bp->b_next)
if (bp->b_y == y && bp->b_x == x)
@@ -1033,11 +1069,12 @@ register int y, x;
* change the underlying character of the shots at a location
* to the given character.
*/
+void
fixshots(y, x, over)
-register int y, x;
-char over;
+ int y, x;
+ char over;
{
- register BULLET *bp;
+ BULLET *bp;
for (bp = Bullets; bp != NULL; bp = bp->b_next)
if (bp->b_y == y && bp->b_x == x)
@@ -1049,10 +1086,11 @@ char over;
* find the underlying character for a bullet when it lands
* on another bullet.
*/
+static void
find_under(blist, bp)
-register BULLET *blist, *bp;
+ BULLET *blist, *bp;
{
- register BULLET *nbp;
+ BULLET *nbp;
for (nbp = blist; nbp != NULL; nbp = nbp->b_next)
if (bp->b_y == nbp->b_y && bp->b_x == nbp->b_x) {
@@ -1065,10 +1103,11 @@ register BULLET *blist, *bp;
* mark_player:
* mark a player as under a shot
*/
+static void
mark_player(bp)
-register BULLET *bp;
+ BULLET *bp;
{
- register PLAYER *pp;
+ PLAYER *pp;
for (pp = Player; pp < End_player; pp++)
if (pp->p_y == bp->b_y && pp->p_x == bp->b_x) {
@@ -1082,10 +1121,11 @@ register BULLET *bp;
* mark_boot:
* mark a boot as under a shot
*/
+static void
mark_boot(bp)
-register BULLET *bp;
+ BULLET *bp;
{
- register PLAYER *pp;
+ PLAYER *pp;
for (pp = Boot; pp < &Boot[NBOOTS]; pp++)
if (pp->p_y == bp->b_y && pp->p_x == bp->b_x) {
diff --git a/hunt/huntd/talk_ctl.h b/hunt/huntd/talk_ctl.h
index 2b73f820..59071ec3 100644
--- a/hunt/huntd/talk_ctl.h
+++ b/hunt/huntd/talk_ctl.h
@@ -62,8 +62,6 @@ typedef struct ctl_msg {
#include <syslog.h>
#endif
-extern int errno;
-
extern struct sockaddr_in daemon_addr;
extern struct sockaddr_in ctl_addr;
extern struct sockaddr_in my_addr;
@@ -78,3 +76,5 @@ extern CTL_MSG msg;
#else
#define p_error(str) perror(str)
#endif
+
+void ctl_transact __P((struct in_addr, CTL_MSG, int, CTL_RESPONSE *));
diff --git a/hunt/huntd/terminal.c b/hunt/huntd/terminal.c
index 13d34850..94493531 100644
--- a/hunt/huntd/terminal.c
+++ b/hunt/huntd/terminal.c
@@ -1,9 +1,20 @@
+/* $NetBSD: terminal.c,v 1.2 1997/10/10 16:34:05 lukem Exp $ */
/*
* Hunt
* Copyright (c) 1985 Conrad C. Huang, Gregory S. Couch, Kenneth C.R.C. Arnold
* San Francisco, California
*/
+#include <sys/cdefs.h>
+#ifndef lint
+__RCSID("$NetBSD: terminal.c,v 1.2 1997/10/10 16:34:05 lukem Exp $");
+#endif /* not lint */
+
+#if __STDC__
+#include <stdarg.h>
+#else
+#include <varargs.h>
+#endif
# include "hunt.h"
# define TERM_WIDTH 80 /* Assume terminals are 80-char wide */
@@ -12,9 +23,10 @@
* Move the cursor to the given position on the given player's
* terminal.
*/
+void
cgoto(pp, y, x)
-register PLAYER *pp;
-register int y, x;
+ PLAYER *pp;
+ int y, x;
{
if (x == pp->p_curx && y == pp->p_cury)
return;
@@ -27,9 +39,10 @@ register int y, x;
* outch:
* Put out a single character.
*/
+void
outch(pp, ch)
-register PLAYER *pp;
-char ch;
+ PLAYER *pp;
+ char ch;
{
if (++pp->p_curx >= TERM_WIDTH) {
pp->p_curx = 0;
@@ -42,10 +55,11 @@ char ch;
* outstr:
* Put out a string of the given length.
*/
+void
outstr(pp, str, len)
-register PLAYER *pp;
-register char *str;
-register int len;
+ PLAYER *pp;
+ char *str;
+ int len;
{
pp->p_curx += len;
pp->p_cury += (pp->p_curx / TERM_WIDTH);
@@ -58,8 +72,9 @@ register int len;
* clrscr:
* Clear the screen, and reset the current position on the screen.
*/
+void
clrscr(pp)
-register PLAYER *pp;
+ PLAYER *pp;
{
sendcom(pp, CLEAR);
pp->p_cury = 0;
@@ -70,41 +85,61 @@ register PLAYER *pp;
* ce:
* Clear to the end of the line
*/
+void
ce(pp)
-PLAYER *pp;
+ PLAYER *pp;
{
sendcom(pp, CLRTOEOL);
}
+#if 0 /* XXX lukem*/
/*
* ref;
* Refresh the screen
*/
+void
ref(pp)
-register PLAYER *pp;
+ PLAYER *pp;
{
sendcom(pp, REFRESH);
}
+#endif
/*
* sendcom:
* Send a command to the given user
*/
-/* VARARGS2 */
-sendcom(pp, command, arg1, arg2)
-register PLAYER *pp;
-register int command;
-int arg1, arg2;
+void
+#if __STDC__
+sendcom(PLAYER *pp, int command, ...)
+#else
+sendcom(pp, command, va_alist)
+ PLAYER *pp;
+ int command;
+ va_dcl
+#endif
{
+ va_list ap;
+ int arg1, arg2;
+#if __STDC__
+ va_start(ap, command);
+#else
+ va_start(ap);
+#endif
(void) putc(command, pp->p_output);
switch (command & 0377) {
- case MOVE:
+ case MOVE:
+ arg1 = va_arg(ap, int);
+ arg2 = va_arg(ap, int);
(void) putc(arg1, pp->p_output);
(void) putc(arg2, pp->p_output);
break;
- case ADDCH:
- case READY:
+ case ADDCH:
+ case READY:
+ arg1 = va_arg(ap, int);
(void) putc(arg1, pp->p_output);
break;
}
+
+ va_end(ap); /* No return needed for void functions. */
}