diff options
author | mestre <mestre@cvs.openbsd.org> | 2016-01-07 21:37:54 +0000 |
---|---|---|
committer | mestre <mestre@cvs.openbsd.org> | 2016-01-07 21:37:54 +0000 |
commit | 9ddb47ac19823b98ea846921984e51022dcff557 (patch) | |
tree | d39753b15368641a0e0454d3028cb9eaa32ecd32 /games/hunt | |
parent | 5f79797d21c65f3c9ef1c018f0d682ef5677f281 (diff) |
ANSIfy hunt(6)
Note: casted 2 args to struct sockaddr * on list.c to shut off compiler
warnings, and also changed an int len to socklen_t since recvfrom(2) receives
the last argument as the latter.
I'm running out of credits, but this was once again with great help and OK from
tb@
Diffstat (limited to 'games/hunt')
-rw-r--r-- | games/hunt/hunt/connect.c | 7 | ||||
-rw-r--r-- | games/hunt/hunt/display.c | 37 | ||||
-rw-r--r-- | games/hunt/hunt/hunt.c | 41 | ||||
-rw-r--r-- | games/hunt/hunt/list.c | 27 | ||||
-rw-r--r-- | games/hunt/hunt/otto.c | 43 | ||||
-rw-r--r-- | games/hunt/hunt/playit.c | 13 | ||||
-rw-r--r-- | games/hunt/huntd/answer.c | 26 | ||||
-rw-r--r-- | games/hunt/huntd/conf.c | 28 | ||||
-rw-r--r-- | games/hunt/huntd/draw.c | 37 | ||||
-rw-r--r-- | games/hunt/huntd/driver.c | 48 | ||||
-rw-r--r-- | games/hunt/huntd/execute.c | 61 | ||||
-rw-r--r-- | games/hunt/huntd/expl.c | 17 | ||||
-rw-r--r-- | games/hunt/huntd/makemaze.c | 15 | ||||
-rw-r--r-- | games/hunt/huntd/shots.c | 64 | ||||
-rw-r--r-- | games/hunt/huntd/terminal.c | 24 |
15 files changed, 160 insertions, 328 deletions
diff --git a/games/hunt/hunt/connect.c b/games/hunt/hunt/connect.c index 3ae9a2d88aa..0699439e76e 100644 --- a/games/hunt/hunt/connect.c +++ b/games/hunt/hunt/connect.c @@ -1,4 +1,4 @@ -/* $OpenBSD: connect.c,v 1.7 2016/01/07 21:29:31 mestre Exp $ */ +/* $OpenBSD: connect.c,v 1.8 2016/01/07 21:37:53 mestre Exp $ */ /* $NetBSD: connect.c,v 1.3 1997/10/11 08:13:40 lukem Exp $ */ /* * Copyright (c) 1983-2003, Regents of the University of California. @@ -38,10 +38,7 @@ #include "client.h" void -do_connect(name, team, enter_status) - char * name; - u_int8_t team; - u_int32_t enter_status; +do_connect(char *name, u_int8_t team, u_int32_t enter_status) { u_int32_t uid; u_int32_t mode; diff --git a/games/hunt/hunt/display.c b/games/hunt/hunt/display.c index bfb0f6a2276..24e08626aef 100644 --- a/games/hunt/hunt/display.c +++ b/games/hunt/hunt/display.c @@ -1,4 +1,4 @@ -/* $OpenBSD: display.c,v 1.7 2016/01/07 21:29:31 mestre Exp $ */ +/* $OpenBSD: display.c,v 1.8 2016/01/07 21:37:53 mestre Exp $ */ /* * Display abstraction. @@ -8,7 +8,7 @@ #include <curses.h> void -display_open() +display_open(void) { initscr(); (void) noecho(); @@ -16,39 +16,37 @@ display_open() } void -display_beep() +display_beep(void) { beep(); } void -display_refresh() +display_refresh(void) { refresh(); } void -display_clear_eol() +display_clear_eol(void) { clrtoeol(); } void -display_put_ch(c) - char c; +display_put_ch(char c) { addch(c); } void -display_put_str(s) - char *s; +display_put_str(char *s) { addstr(s); } void -display_clear_the_screen() +display_clear_the_screen(void) { clear(); move(0, 0); @@ -56,28 +54,25 @@ display_clear_the_screen() } void -display_move(y, x) - int y, x; +display_move(int y, int x) { move(y, x); } void -display_getyx(yp, xp) - int *yp, *xp; +display_getyx(int *yp, int *xp) { getyx(stdscr, *yp, *xp); } void -display_end() +display_end(void) { endwin(); } char -display_atyx(y, x) - int y, x; +display_atyx(int y, int x) { int oy, ox; char c; @@ -89,22 +84,20 @@ display_atyx(y, x) } void -display_redraw_screen() +display_redraw_screen(void) { clearok(stdscr, TRUE); touchwin(stdscr); } int -display_iserasechar(ch) - char ch; +display_iserasechar(char ch) { return ch == erasechar(); } int -display_iskillchar(ch) - char ch; +display_iskillchar(char ch) { return ch == killchar(); } diff --git a/games/hunt/hunt/hunt.c b/games/hunt/hunt/hunt.c index f5be12871ce..144d4e49967 100644 --- a/games/hunt/hunt/hunt.c +++ b/games/hunt/hunt/hunt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hunt.c,v 1.18 2016/01/07 21:29:31 mestre Exp $ */ +/* $OpenBSD: hunt.c,v 1.19 2016/01/07 21:37:53 mestre Exp $ */ /* $NetBSD: hunt.c,v 1.8 1998/09/13 15:27:28 hubertf Exp $ */ /* * Copyright (c) 1983-2003, Regents of the University of California. @@ -82,9 +82,7 @@ static int find_driver(void); * Main program for local process */ int -main(ac, av) - int ac; - char **av; +main(int ac, char **av) { int c; extern int optind; @@ -146,7 +144,7 @@ main(ac, av) fputs("usage: hunt [-bcfmqSs] [-n name] [-p port] " "[-t team] [-w message] [[-h] host]\n", stderr); - exit(1); + return 1; } } if (optind + 1 < ac) @@ -164,7 +162,7 @@ main(ac, av) if (Show_scores) { dump_scores(); - exit(0); + return 0; } if (Query_driver) { @@ -179,7 +177,7 @@ main(ac, av) if (Sock_host) break; } - exit(0); + return 0; } if (Otto_mode) { if (Am_monitor) @@ -251,8 +249,7 @@ main(ac, av) break; } leave(0, (char *) NULL); - /* NOTREACHED */ - return(0); + return 0; } /* @@ -263,7 +260,7 @@ main(ac, av) * then we choose it. Otherwise we present a list of the found drivers. */ static int -find_driver() +find_driver(void) { int last_driver, numdrivers, waiting, is_current; struct driver *driver; @@ -361,7 +358,7 @@ find_driver() } static void -dump_scores() +dump_scores(void) { struct driver *driver; int s, cnt, i; @@ -405,7 +402,7 @@ dump_scores() * means the game is full. */ void -bad_con() +bad_con(void) { leave(1, "lost connection to huntd"); } @@ -415,7 +412,7 @@ bad_con() * version number mismatch. */ void -bad_ver() +bad_ver(void) { errno = 0; leave(1, "Version number mismatch. No go."); @@ -426,8 +423,7 @@ bad_ver() * Handle a terminate signal */ static void -sigterm(dummy) - int dummy; +sigterm(int dummy) { leave(0, (char *) NULL); } @@ -437,8 +433,7 @@ sigterm(dummy) * Remove a '\n' at the end of a string if there is one */ static void -rmnl(s) - char *s; +rmnl(char *s) { char *cp; @@ -452,8 +447,7 @@ rmnl(s) * Handle a interrupt signal */ void -intr(dummy) - int dummy; +intr(int dummy) { int ch; int explained; @@ -499,9 +493,7 @@ intr(dummy) * tty stats. */ static void -leave(eval, mesg) - int eval; - char *mesg; +leave(int eval, char *mesg) { int saved_errno; @@ -525,8 +517,7 @@ leave(eval, mesg) * initialise game parameters from the HUNT envvar */ static long -env_init(enter_status) - long enter_status; +env_init(long enter_status) { int i; char *envp, *envname, *s; @@ -638,7 +629,7 @@ env_init(enter_status) * quiz the user for the information they didn't provide earlier */ static void -fill_in_blanks() +fill_in_blanks(void) { int i; char *cp; diff --git a/games/hunt/hunt/list.c b/games/hunt/hunt/list.c index d29f88a5e7b..50a00da2247 100644 --- a/games/hunt/hunt/list.c +++ b/games/hunt/hunt/list.c @@ -1,4 +1,4 @@ -/* $OpenBSD: list.c,v 1.7 2016/01/07 21:29:31 mestre Exp $ */ +/* $OpenBSD: list.c,v 1.8 2016/01/07 21:37:53 mestre Exp $ */ /* * Copyright 2001, David Leonard. All rights reserved. * Redistribution and use in source and binary forms with or without @@ -35,21 +35,21 @@ static int probe_sock[64]; static struct timeval probe_timeout; struct driver * -next_driver() +next_driver(void) { return next_driver_fd(-1); } struct driver * -next_driver_fd(fd) - int fd; +next_driver_fd(int fd) { fd_set r; int maxfd = -1; - int i, s, ret, len; + int i, s, ret; struct driver *driver; u_int16_t resp; + socklen_t len; if (fd == -1 && numprobes == 0) return NULL; @@ -127,8 +127,7 @@ next_driver_fd(fd) /* Return the hostname for a driver. */ const char * -driver_name(driver) - struct driver *driver; +driver_name(struct driver *driver) { const char *name; static char buf[80]; @@ -153,9 +152,7 @@ driver_name(driver) } static int -start_probe(addr, req) - struct sockaddr *addr; - u_int16_t req; +start_probe(struct sockaddr *addr, u_int16_t req) { u_int16_t msg; int s; @@ -192,7 +189,7 @@ start_probe(addr, req) } void -probe_cleanup() +probe_cleanup(void) { int i; @@ -206,9 +203,7 @@ probe_cleanup() * Otherwise, send the request message only to the preferred host. */ void -probe_drivers(req, preferred) - u_int16_t req; - char *preferred; +probe_drivers(u_int16_t req, char *preferred) { struct sockaddr_in *target; struct sockaddr_in localhost; @@ -246,7 +241,7 @@ probe_drivers(req, preferred) if (!target) errx(1, "Bad hostname: %s", preferred); - start_probe(target, req); + start_probe((struct sockaddr *)target, req); return; } @@ -304,7 +299,7 @@ probe_drivers(req, preferred) } else continue; - start_probe(target, req); + start_probe((struct sockaddr *)target, req); } free(inbuf); (void) close(fd); diff --git a/games/hunt/hunt/otto.c b/games/hunt/hunt/otto.c index 01d9568629e..8e13caa50a6 100644 --- a/games/hunt/hunt/otto.c +++ b/games/hunt/hunt/otto.c @@ -1,4 +1,4 @@ -/* $OpenBSD: otto.c,v 1.12 2016/01/07 21:29:31 mestre Exp $ */ +/* $OpenBSD: otto.c,v 1.13 2016/01/07 21:37:53 mestre Exp $ */ /* $NetBSD: otto.c,v 1.2 1997/10/10 16:32:39 lukem Exp $ */ /* * Copyright (c) 1983-2003, Regents of the University of California. @@ -134,11 +134,7 @@ static void wander(void); static void _panic(const char *, int, const char *); int -otto(y, x, face, buf, buflen) - int y, x; - char face; - char *buf; - size_t buflen; +otto(int y, int x, char face, char *buf, size_t buflen) { int i; @@ -193,11 +189,7 @@ done: } static int -stop_look(itemp, c, dist, side) - struct item *itemp; - char c; - int dist; - int side; +stop_look(struct item *itemp, char c, int dist, int side) { switch (c) { @@ -264,9 +256,7 @@ stop_look(itemp, c, dist, side) } static void -ottolook(rel_dir, itemp) - int rel_dir; - struct item *itemp; +ottolook(int rel_dir, struct item *itemp) { int r, c; char ch; @@ -366,7 +356,7 @@ ottolook(rel_dir, itemp) } static void -look_around() +look_around(void) { int i; @@ -380,8 +370,7 @@ look_around() */ static void -face_and_move_direction(rel_dir, distance) - int rel_dir, distance; +face_and_move_direction(int rel_dir, int distance) { int old_facing; char cmd; @@ -417,9 +406,7 @@ face_and_move_direction(rel_dir, distance) } static void -attack(rel_dir, itemp) - int rel_dir; - struct item *itemp; +attack(int rel_dir, struct item *itemp) { if (!(itemp->flags & ON_SIDE)) { face_and_move_direction(rel_dir, 0); @@ -445,8 +432,7 @@ attack(rel_dir, itemp) } static void -duck(rel_dir) - int rel_dir; +duck(int rel_dir) { int dir; @@ -495,8 +481,7 @@ duck(rel_dir) */ static int -go_for_ammo(mine) - char mine; +go_for_ammo(char mine) { int i, rel_dir, dist; @@ -522,7 +507,7 @@ go_for_ammo(mine) } static void -wander() +wander(void) { int i, j, rel_dir, dir_mask, dir_count; @@ -566,17 +551,13 @@ wander() /* Otto always re-enters the game, cloaked. */ int -otto_quit(old_status) - int old_status; +otto_quit(int old_status) { return Q_CLOAK; } static void -_panic(file, line, msg) - const char *file; - int line; - const char *msg; +_panic(const char *file, int line, const char *msg) { fprintf(stderr, "%s:%d: panic! %s\n", file, line, msg); diff --git a/games/hunt/hunt/playit.c b/games/hunt/hunt/playit.c index 8d0537fc73b..c488929ba11 100644 --- a/games/hunt/hunt/playit.c +++ b/games/hunt/hunt/playit.c @@ -1,4 +1,4 @@ -/* $OpenBSD: playit.c,v 1.10 2016/01/07 21:29:31 mestre Exp $ */ +/* $OpenBSD: playit.c,v 1.11 2016/01/07 21:37:53 mestre Exp $ */ /* $NetBSD: playit.c,v 1.4 1997/10/20 00:37:15 lukem Exp $ */ /* * Copyright (c) 1983-2003, Regents of the University of California. @@ -68,7 +68,7 @@ static void send_stuff(void); * the driver. */ void -playit() +playit(void) { int ch; int y, x; @@ -181,7 +181,7 @@ out: * no characters in the input buffer. */ static unsigned char -getchr() +getchr(void) { fd_set readfds, s_readfds; int nfds, s_nfds; @@ -219,7 +219,7 @@ one_more_time: * Send standard input characters to the driver */ static void -send_stuff() +send_stuff(void) { int count; char *sp, *nsp; @@ -271,8 +271,7 @@ send_stuff() * Handle the end of the game when the player dies */ int -quit(old_status) - int old_status; +quit(int old_status) { int explain, ch; @@ -392,7 +391,7 @@ get_message: * Send a message to the driver and return */ void -do_message() +do_message(void) { u_int32_t version; diff --git a/games/hunt/huntd/answer.c b/games/hunt/huntd/answer.c index 9b915923570..951c2d7304c 100644 --- a/games/hunt/huntd/answer.c +++ b/games/hunt/huntd/answer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: answer.c,v 1.16 2016/01/07 21:29:31 mestre Exp $ */ +/* $OpenBSD: answer.c,v 1.17 2016/01/07 21:37:53 mestre Exp $ */ /* $NetBSD: answer.c,v 1.3 1997/10/10 16:32:50 lukem Exp $ */ /* * Copyright (c) 1983-2003, Regents of the University of California. @@ -58,7 +58,7 @@ static void stmonitor(PLAYER *); static IDENT * get_ident(struct sockaddr *, int, u_long, char *, char); void -answer_first() +answer_first(void) { struct sockaddr sockstruct; int newsock; @@ -117,8 +117,7 @@ answer_first() } int -answer_next(sp) - struct spawn *sp; +answer_next(struct spawn *sp) { PLAYER *pp; char *cp1, *cp2; @@ -273,8 +272,7 @@ close_it: /* Start a monitor: */ static void -stmonitor(pp) - PLAYER *pp; +stmonitor(PLAYER *pp) { /* Monitors get to see the entire maze: */ @@ -295,9 +293,7 @@ stmonitor(pp) /* Start a player: */ static void -stplayer(newpp, enter_status) - PLAYER *newpp; - int enter_status; +stplayer(PLAYER *newpp, int enter_status) { int x, y; PLAYER *pp; @@ -421,7 +417,7 @@ stplayer(newpp, enter_status) * Return a random direction */ int -rand_dir() +rand_dir(void) { switch (rand_num(4)) { case 0: @@ -442,12 +438,7 @@ rand_dir() * Get the score structure of a player */ static IDENT * -get_ident(sa, salen, uid, name, team) - struct sockaddr *sa; - int salen; - u_long uid; - char *name; - char team; +get_ident(struct sockaddr *sa, int salen, u_long uid, char *name, char team) { IDENT *ip; static IDENT punt; @@ -519,8 +510,7 @@ get_ident(sa, salen, uid, name, team) } void -answer_info(fp) - FILE *fp; +answer_info(FILE *fp) { struct spawn *sp; char buf[128]; diff --git a/games/hunt/huntd/conf.c b/games/hunt/huntd/conf.c index 39cbf57e151..26dfa531598 100644 --- a/games/hunt/huntd/conf.c +++ b/games/hunt/huntd/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.9 2016/01/07 21:29:31 mestre Exp $ */ +/* $OpenBSD: conf.c,v 1.10 2016/01/07 21:37:53 mestre Exp $ */ /* David Leonard <d@openbsd.org>, 1999. Public domain. */ #include <ctype.h> @@ -120,11 +120,7 @@ static struct kwvar keywords[] = { }; static char * -parse_int(p, kvp, fnm, linep) - char *p; - struct kwvar *kvp; - const char *fnm; - int *linep; +parse_int(char *p, struct kwvar *kvp, const char *fnm, int *linep) { char *valuestart, *digitstart; char savec; @@ -155,11 +151,7 @@ parse_int(p, kvp, fnm, linep) } static char * -parse_value(p, kvp, fnm, linep) - char *p; - struct kwvar *kvp; - const char *fnm; - int *linep; +parse_value(char *p, struct kwvar *kvp, const char *fnm, int *linep) { switch (kvp->type) { @@ -175,10 +167,7 @@ parse_value(p, kvp, fnm, linep) } static void -parse_line(buf, fnm, line) - char *buf; - char *fnm; - int *line; +parse_line(char *buf, char *fnm, int *line) { char *p; char *word; @@ -255,9 +244,7 @@ parse_line(buf, fnm, line) static void -load_config(f, fnm) - FILE * f; - char * fnm; +load_config(FILE *f, char *fnm) { char buf[BUFSIZ]; size_t len; @@ -284,7 +271,7 @@ load_config(f, fnm) * overwrite earlier values */ void -config() +config(void) { char *home; char nm[MAXNAMLEN + 1]; @@ -316,8 +303,7 @@ config() * Parse a single configuration argument given on the command line */ void -config_arg(arg) - char *arg; +config_arg( char *arg) { int line = 0; diff --git a/games/hunt/huntd/draw.c b/games/hunt/huntd/draw.c index b28dc074135..9c9c86b631b 100644 --- a/games/hunt/huntd/draw.c +++ b/games/hunt/huntd/draw.c @@ -1,4 +1,4 @@ -/* $OpenBSD: draw.c,v 1.8 2016/01/07 21:29:31 mestre Exp $ */ +/* $OpenBSD: draw.c,v 1.9 2016/01/07 21:37:53 mestre Exp $ */ /* $NetBSD: draw.c,v 1.2 1997/10/10 16:33:04 lukem Exp $ */ /* * Copyright (c) 1983-2003, Regents of the University of California. @@ -47,8 +47,7 @@ static void see(PLAYER *, int); * Draw the entire maze on a player's screen. */ void -drawmaze(pp) - PLAYER *pp; +drawmaze(PLAYER *pp) { int x; char *sp; @@ -85,8 +84,7 @@ drawmaze(pp) * size is 80x24 with the maze being 64x24) */ static void -drawstatus(pp) - PLAYER *pp; +drawstatus(PLAYER *pp) { int i; PLAYER *np; @@ -125,8 +123,7 @@ drawstatus(pp) * check and update the visible area around the player */ void -look(pp) - PLAYER *pp; +look(PLAYER *pp) { int x, y; @@ -184,9 +181,7 @@ look(pp) * is a simulation of visibility from the player's perspective. */ static void -see(pp, face) - PLAYER *pp; - int face; +see(PLAYER *pp, int face) { char *sp; int y, x; @@ -226,9 +221,7 @@ see(pp, face) * Ensure it is shown properly on their screen. */ void -check(pp, y, x) - PLAYER *pp; - int y, x; +check(PLAYER *pp, int y, int x) { int index; int ch; @@ -262,8 +255,7 @@ check(pp, y, x) * Update the status of a player on everyone's screen */ void -showstat(pp) - PLAYER *pp; +showstat(PLAYER *pp) { outyx(ALL_PLAYERS, @@ -279,9 +271,7 @@ showstat(pp) * be drawn instead of the player; effectively un-drawing the player. */ void -drawplayer(pp, draw) - PLAYER *pp; - FLAG draw; +drawplayer(PLAYER *pp, FLAG draw) { PLAYER *newp; int x, y; @@ -337,9 +327,7 @@ drawplayer(pp, draw) * Write a message at the bottom of the screen. */ void -message(pp, s) - PLAYER *pp; - char *s; +message(PLAYER *pp, char *s) { cgoto(pp, HEIGHT, 0); outstr(pp, s, strlen(s)); @@ -352,8 +340,7 @@ message(pp, s) * ie: {,},!,i becomes <,>,v,^ */ static char -translate(ch) - char ch; +translate(char ch) { switch (ch) { case LEFTS: @@ -376,9 +363,7 @@ translate(ch) * - teamed players see other players on their team, as a digit */ static int -player_sym(pp, y, x) - PLAYER *pp; - int y, x; +player_sym(PLAYER *pp, int y, int x) { PLAYER *npp; diff --git a/games/hunt/huntd/driver.c b/games/hunt/huntd/driver.c index bf03d09b3c3..159a163594f 100644 --- a/games/hunt/huntd/driver.c +++ b/games/hunt/huntd/driver.c @@ -1,4 +1,4 @@ -/* $OpenBSD: driver.c,v 1.25 2016/01/07 21:29:31 mestre Exp $ */ +/* $OpenBSD: driver.c,v 1.26 2016/01/07 21:37:53 mestre Exp $ */ /* $NetBSD: driver.c,v 1.5 1997/10/20 00:37:16 lukem Exp $ */ /* * Copyright (c) 1983-2003, Regents of the University of California. @@ -60,7 +60,6 @@ in_addr_t Server_addr = INADDR_ANY; /* address to bind to */ static void clear_scores(void); static int havechar(PLAYER *); static void init(int); - int main(int, char *[]); static void makeboots(void); static void send_stats(void); static void zap(PLAYER *, FLAG); @@ -74,9 +73,7 @@ static void handle_wkport(int); * The main program. */ int -main(ac, av) - int ac; - char **av; +main(int ac, char **av) { PLAYER *pp; int had_char; @@ -124,7 +121,7 @@ erred: "usage: %s [-bs] [-a addr] [-D var=value] " "[-p port]\n", __progname); - exit(2); + return 2; } } if (optind < ac) @@ -313,7 +310,7 @@ again: /* Fin: */ cleanup(0); - exit(0); + return 0; } /* @@ -485,7 +482,7 @@ init(int background) * Put the boots in the maze */ static void -makeboots() +makeboots(void) { int x, y; PLAYER *pp; @@ -509,11 +506,8 @@ makeboots() * If the victim dies as a result, give points to 'credit', */ void -checkdam(victim, attacker, credit, damage, shot_type) - PLAYER *victim, *attacker; - IDENT *credit; - int damage; - char shot_type; +checkdam(PLAYER *victim, PLAYER *attacker, IDENT *credit, int damage, + char shot_type) { char *cp; int y; @@ -669,9 +663,7 @@ checkdam(victim, attacker, credit, damage, shot_type) * a monitor and needs extra cleaning up. */ static void -zap(pp, was_player) - PLAYER *pp; - FLAG was_player; +zap(PLAYER *pp, FLAG was_player) { int len; BULLET *bp; @@ -905,8 +897,7 @@ zap(pp, was_player) * Return a random number in a given range. */ int -rand_num(range) - int range; +rand_num(int range) { return (arc4random_uniform(range)); } @@ -918,8 +909,7 @@ rand_num(range) * FALSE. */ static int -havechar(pp) - PLAYER *pp; +havechar(PLAYER *pp) { int ret; @@ -965,8 +955,7 @@ check_again: * Exit with the given value, cleaning up any droppings lying around */ void -cleanup(eval) - int eval; +cleanup(int eval) { PLAYER *pp; @@ -996,7 +985,7 @@ cleanup(eval) * the stats. */ static void -send_stats() +send_stats(void) { FILE *fp; int s; @@ -1036,8 +1025,7 @@ send_stats() * emit the game statistics */ void -print_stats(fp) - FILE *fp; +print_stats(FILE *fp) { IDENT *ip; PLAYER *pp; @@ -1084,8 +1072,7 @@ print_stats(fp) * Send the game statistics to the controlling tty */ static void -siginfo(sig) - int sig; +siginfo(int sig) { int tty; FILE *fp; @@ -1103,7 +1090,7 @@ siginfo(sig) * Clear the Scores list. */ static void -clear_scores() +clear_scores(void) { IDENT *ip, *nextip; @@ -1120,7 +1107,7 @@ clear_scores() * Publically announce the game */ static void -announce_game() +announce_game(void) { /* TODO: could use system() to do something user-configurable */ @@ -1130,8 +1117,7 @@ announce_game() * Handle a UDP packet sent to the well known port. */ static void -handle_wkport(fd) - int fd; +handle_wkport(int fd) { struct sockaddr fromaddr; socklen_t fromlen; diff --git a/games/hunt/huntd/execute.c b/games/hunt/huntd/execute.c index f00218bc52d..a6af15c5290 100644 --- a/games/hunt/huntd/execute.c +++ b/games/hunt/huntd/execute.c @@ -1,4 +1,4 @@ -/* $OpenBSD: execute.c,v 1.11 2016/01/07 21:29:31 mestre Exp $ */ +/* $OpenBSD: execute.c,v 1.12 2016/01/07 21:37:53 mestre Exp $ */ /* $NetBSD: execute.c,v 1.2 1997/10/10 16:33:13 lukem Exp $ */ /* * Copyright (c) 1983-2003, Regents of the University of California. @@ -53,8 +53,7 @@ static void scan(PLAYER *); * Execute a single monitor command */ void -mon_execute(pp) - PLAYER *pp; +mon_execute(PLAYER *pp) { char ch; @@ -80,8 +79,7 @@ mon_execute(pp) * Execute a single command from a player */ void -execute(pp) - PLAYER *pp; +execute(PLAYER *pp) { char ch; @@ -196,9 +194,7 @@ execute(pp) * Try to move player 'pp' in direction 'dir'. */ static void -move_player(pp, dir) - PLAYER *pp; - int dir; +move_player(PLAYER *pp, int dir) { PLAYER *newp; int x, y; @@ -342,9 +338,7 @@ move_player(pp, dir) * Change the direction the player is facing */ static void -face(pp, dir) - PLAYER *pp; - int dir; +face(PLAYER *pp, int dir) { if (pp->p_face != dir) { pp->p_face = dir; @@ -357,9 +351,7 @@ face(pp, dir) * Fire a shot of the given type in the given direction */ static void -fire(pp, req_index) - PLAYER *pp; - int req_index; +fire(PLAYER *pp, int req_index) { if (pp == NULL) return; @@ -403,9 +395,7 @@ fire(pp, req_index) * Fire a slime shot in the given direction */ static void -fire_slime(pp, req_index) - PLAYER *pp; - int req_index; +fire_slime(PLAYER *pp, int req_index) { if (pp == NULL) return; @@ -453,14 +443,8 @@ fire_slime(pp, req_index) * Create a shot with the given properties */ void -add_shot(type, y, x, face, charge, owner, expl, over) - int type; - int y, x; - char face; - int charge; - PLAYER *owner; - int expl; - char over; +add_shot(int type, int y, int x, char face, int charge, PLAYER *owner, + int expl, char over) { BULLET *bp; int size; @@ -504,16 +488,8 @@ add_shot(type, y, x, face, charge, owner, expl, over) * initialize and return it */ 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; +create_shot(int type, int y, int x, char face, int charge, int size, + PLAYER *owner, IDENT *score, int expl, char over) { BULLET *bp; @@ -545,8 +521,7 @@ create_shot(type, y, x, face, charge, size, owner, score, expl, over) * Turn on or increase length of a cloak */ static void -cloak(pp) - PLAYER *pp; +cloak(PLAYER *pp) { /* Check configuration: */ if (!conf_cloak) @@ -584,8 +559,7 @@ cloak(pp) * Turn on or increase length of a scan */ static void -scan(pp) - PLAYER *pp; +scan(PLAYER *pp) { /* Check configuration: */ if (!conf_scan) @@ -617,11 +591,7 @@ scan(pp) * pick up a mine or grenade, with some probability of it exploding */ static void -pickup(pp, y, x, prob, obj) - PLAYER *pp; - int y, x; - int prob; - int obj; +pickup(PLAYER *pp, int y, int x, int prob, int obj) { int req; @@ -653,8 +623,7 @@ pickup(pp, y, x, prob, obj) } void -ammo_update(pp) - PLAYER *pp; +ammo_update(PLAYER *pp) { outyx(pp, STAT_AMMO_ROW, STAT_VALUE_COL - 1, "%4d", pp->p_ammo); } diff --git a/games/hunt/huntd/expl.c b/games/hunt/huntd/expl.c index 8c997260418..10cd97bfcb5 100644 --- a/games/hunt/huntd/expl.c +++ b/games/hunt/huntd/expl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: expl.c,v 1.12 2016/01/07 21:29:31 mestre Exp $ */ +/* $OpenBSD: expl.c,v 1.13 2016/01/07 21:37:53 mestre Exp $ */ /* $NetBSD: expl.c,v 1.2 1997/10/10 16:33:18 lukem Exp $ */ /* * Copyright (c) 1983-2003, Regents of the University of California. @@ -48,9 +48,7 @@ static void init_removed(void); * Show the explosions as they currently are */ void -showexpl(y, x, type) - int y, x; - char type; +showexpl(int y, int x, char type) { PLAYER *pp; EXPL *ep; @@ -106,7 +104,7 @@ showexpl(y, x, type) * top */ void -rollexpl() +rollexpl(void) { EXPL *ep; PLAYER *pp; @@ -139,7 +137,7 @@ rollexpl() } int -can_rollexpl() +can_rollexpl(void) { int i; @@ -153,7 +151,7 @@ static REGEN *removed = NULL; static REGEN *rem_index = NULL; static void -init_removed() +init_removed(void) { rem_index = removed = calloc(conf_maxremove, sizeof(REGEN)); if (rem_index == NULL) { @@ -168,8 +166,7 @@ init_removed() * the location currently pointed at. */ static void -remove_wall(y, x) - int y, x; +remove_wall(int y, int x) { REGEN *r; PLAYER *pp; @@ -242,7 +239,7 @@ found: * Clear out the walls array */ void -clearwalls() +clearwalls(void) { REGEN *rp; diff --git a/games/hunt/huntd/makemaze.c b/games/hunt/huntd/makemaze.c index eb671232267..f6f5660d821 100644 --- a/games/hunt/huntd/makemaze.c +++ b/games/hunt/huntd/makemaze.c @@ -1,4 +1,4 @@ -/* $OpenBSD: makemaze.c,v 1.7 2016/01/07 21:29:31 mestre Exp $ */ +/* $OpenBSD: makemaze.c,v 1.8 2016/01/07 21:37:53 mestre Exp $ */ /* $NetBSD: makemaze.c,v 1.2 1997/10/10 16:33:43 lukem Exp $ */ /* * Copyright (c) 1983-2003, Regents of the University of California. @@ -46,7 +46,7 @@ static void dig_maze(int, int); static void remap(void); void -makemaze() +makemaze(void) { char *sp; int y, x; @@ -81,8 +81,7 @@ int incr[NDIR][2] = { }; static void -dig(y, x) - int y, x; +dig(int y, int x) { int *dp; int *ip; @@ -106,8 +105,7 @@ dig(y, x) * Is it legal to clear this spot? */ static int -candig(y, x) - int y, x; +candig(int y, int x) { int i; @@ -137,8 +135,7 @@ candig(y, x) } static void -dig_maze(x, y) - int x, y; +dig_maze(int x, int y) { int tx, ty; int i, j; @@ -185,7 +182,7 @@ dig_maze(x, y) } static void -remap() +remap(void) { int y, x; char *sp; diff --git a/games/hunt/huntd/shots.c b/games/hunt/huntd/shots.c index 01e2f663f43..fea7e35f943 100644 --- a/games/hunt/huntd/shots.c +++ b/games/hunt/huntd/shots.c @@ -1,4 +1,4 @@ -/* $OpenBSD: shots.c,v 1.11 2016/01/07 21:29:31 mestre Exp $ */ +/* $OpenBSD: shots.c,v 1.12 2016/01/07 21:37:53 mestre Exp $ */ /* $NetBSD: shots.c,v 1.3 1997/10/11 08:13:50 lukem Exp $ */ /* * Copyright (c) 1983-2003, Regents of the University of California. @@ -57,7 +57,7 @@ static void zapshot(BULLET *, BULLET *); /* Return true if there is pending activity */ int -can_moveshots() +can_moveshots(void) { PLAYER *pp; @@ -86,7 +86,7 @@ can_moveshots() * Move the shots already in the air, taking explosions into account */ void -moveshots() +moveshots(void) { BULLET *bp, *next; PLAYER *pp; @@ -221,8 +221,7 @@ no_bullets: * Returns false if the bullet no longer needs tracking. */ static int -move_normal_shot(bp) - BULLET *bp; +move_normal_shot(BULLET *bp) { int i, x, y; PLAYER *pp; @@ -449,8 +448,7 @@ move_normal_shot(bp) * Returns FALSE if the drone need no longer be tracked. */ static int -move_drone(bp) - BULLET *bp; +move_drone(BULLET *bp) { int mask, count; int n, dir = -1; @@ -590,8 +588,7 @@ drone_move: * Put a bullet back onto the bullet list */ static void -save_bullet(bp) - BULLET *bp; +save_bullet(BULLET *bp) { /* Save what the bullet will be flying over: */ @@ -642,8 +639,7 @@ save_bullet(bp) * Update the position of a player in flight */ static void -move_flyer(pp) - PLAYER *pp; +move_flyer(PLAYER *pp) { int x, y; @@ -749,9 +745,7 @@ again: * Handle explosions */ static void -chkshot(bp, next) - BULLET *bp; - BULLET *next; +chkshot(BULLET *bp, BULLET *next) { int y, x; int dy, dx, absdy; @@ -842,9 +836,7 @@ chkshot(bp, next) * handle slime shot exploding */ static void -chkslime(bp, next) - BULLET *bp; - BULLET *next; +chkslime(BULLET *bp, BULLET *next) { BULLET *nbp; @@ -892,10 +884,7 @@ chkslime(bp, next) * it hasn't fizzled yet */ static void -move_slime(bp, speed, next) - BULLET *bp; - int speed; - BULLET *next; +move_slime(BULLET *bp, int speed, BULLET *next) { int i, j, dirmask, count; PLAYER *pp; @@ -1053,8 +1042,7 @@ move_slime(bp, speed, next) * returns whether the given location is a wall */ static int -iswall(y, x) - int y, x; +iswall(int y, int x) { if (y < 0 || x < 0 || y >= HEIGHT || x >= WIDTH) return TRUE; @@ -1077,8 +1065,7 @@ iswall(y, x) * Take a shot out of the air. */ static void -zapshot(blist, obp) - BULLET *blist, *obp; +zapshot(BULLET *blist, BULLET *obp) { BULLET *bp; @@ -1099,9 +1086,7 @@ zapshot(blist, obp) * Make all shots at this location blow up */ static void -explshot(blist, y, x) - BULLET *blist; - int y, x; +explshot(BULLET *blist, int y, int x) { BULLET *bp; @@ -1118,8 +1103,7 @@ explshot(blist, y, x) * Return a pointer to the player at the given location */ PLAYER * -play_at(y, x) - int y, x; +play_at(int y, int x) { PLAYER *pp; @@ -1138,9 +1122,7 @@ play_at(y, x) * of the player in the maze */ int -opposite(face, dir) - int face; - char dir; +opposite(int face, char dir) { switch (face) { case LEFTS: @@ -1162,8 +1144,7 @@ opposite(face, dir) * a pointer to the bullet, otherwise return NULL */ BULLET * -is_bullet(y, x) - int y, x; +is_bullet(int y, int x) { BULLET *bp; @@ -1179,9 +1160,7 @@ is_bullet(y, x) * to the given character. */ void -fixshots(y, x, over) - int y, x; - char over; +fixshots(int y, int x, char over) { BULLET *bp; @@ -1196,8 +1175,7 @@ fixshots(y, x, over) * on another bullet. */ static void -find_under(blist, bp) - BULLET *blist, *bp; +find_under(BULLET *blist, BULLET *bp) { BULLET *nbp; @@ -1213,8 +1191,7 @@ find_under(blist, bp) * mark a player as under a shot */ static void -mark_player(bp) - BULLET *bp; +mark_player(BULLET *bp) { PLAYER *pp; @@ -1230,8 +1207,7 @@ mark_player(bp) * mark a boot as under a shot */ static void -mark_boot(bp) - BULLET *bp; +mark_boot(BULLET *bp) { PLAYER *pp; diff --git a/games/hunt/huntd/terminal.c b/games/hunt/huntd/terminal.c index 89275c6f59d..258844155e7 100644 --- a/games/hunt/huntd/terminal.c +++ b/games/hunt/huntd/terminal.c @@ -1,4 +1,4 @@ -/* $OpenBSD: terminal.c,v 1.11 2016/01/07 21:29:31 mestre Exp $ */ +/* $OpenBSD: terminal.c,v 1.12 2016/01/07 21:37:53 mestre Exp $ */ /* $NetBSD: terminal.c,v 1.2 1997/10/10 16:34:05 lukem Exp $ */ /* * Copyright (c) 1983-2003, Regents of the University of California. @@ -48,9 +48,7 @@ * terminal. */ void -cgoto(pp, y, x) - PLAYER *pp; - int y, x; +cgoto(PLAYER *pp, int y, int x) { if (pp == ALL_PLAYERS) { @@ -74,9 +72,7 @@ cgoto(pp, y, x) * Put out a single character. */ void -outch(pp, ch) - PLAYER *pp; - char ch; +outch(PLAYER *pp, char ch) { if (pp == ALL_PLAYERS) { @@ -99,10 +95,7 @@ outch(pp, ch) * Put out a string of the given length. */ void -outstr(pp, str, len) - PLAYER *pp; - char *str; - int len; +outstr(PLAYER *pp, char *str, int len) { if (pp == ALL_PLAYERS) { for (pp = Player; pp < End_player; pp++) @@ -149,8 +142,7 @@ outyx(PLAYER *pp, int y, int x, const char *fmt, ...) * Clear the screen, and reset the current position on the screen. */ void -clrscr(pp) - PLAYER *pp; +clrscr(PLAYER *pp) { if (pp == ALL_PLAYERS) { @@ -171,8 +163,7 @@ clrscr(pp) * Clear to the end of the line */ void -ce(pp) - PLAYER *pp; +ce(PLAYER *pp) { sendcom(pp, CLRTOEOL); } @@ -218,8 +209,7 @@ sendcom(PLAYER *pp, int command, ...) * Flush the output buffer to the player */ void -flush(pp) - PLAYER *pp; +flush(PLAYER *pp) { if (pp == ALL_PLAYERS) { for (pp = Player; pp < End_player; pp++) |