From 4c39d3d5d3a9a029eecd375d4c55d91ed234cc9c Mon Sep 17 00:00:00 2001 From: dholland Date: Mon, 28 Jan 2008 03:23:29 +0000 Subject: clean for WARNS=4 --- hunt/hunt/hunt.c | 27 ++++++++++++--------------- hunt/hunt/playit.c | 8 ++++---- hunt/huntd/answer.c | 14 +++++++------- hunt/huntd/draw.c | 16 ++++++++-------- hunt/huntd/driver.c | 16 ++++++++-------- hunt/huntd/execute.c | 18 +++++++++--------- hunt/huntd/hunt.h | 14 +++++++------- hunt/huntd/pathname.c | 6 +++--- hunt/huntd/terminal.c | 6 +++--- 9 files changed, 61 insertions(+), 64 deletions(-) (limited to 'hunt') diff --git a/hunt/hunt/hunt.c b/hunt/hunt/hunt.c index dc06802f..780eaa29 100644 --- a/hunt/hunt/hunt.c +++ b/hunt/hunt/hunt.c @@ -1,4 +1,4 @@ -/* $NetBSD: hunt.c,v 1.25 2007/12/15 19:44:41 perry Exp $ */ +/* $NetBSD: hunt.c,v 1.26 2008/01/28 03:23:29 dholland Exp $ */ /* * Copyright (c) 1983-2003, Regents of the University of California. * All rights reserved. @@ -32,7 +32,7 @@ #include #ifndef lint -__RCSID("$NetBSD: hunt.c,v 1.25 2007/12/15 19:44:41 perry Exp $"); +__RCSID("$NetBSD: hunt.c,v 1.26 2008/01/28 03:23:29 dholland Exp $"); #endif /* not lint */ # include @@ -111,8 +111,8 @@ extern int cur_row, cur_col; void dump_scores(SOCKET); long env_init(long); void fill_in_blanks(void); -void leave(int, char *) __dead; -void leavex(int, char *) __dead; +void leave(int, const char *) __dead; +void leavex(int, const char *) __dead; void fincurs(void); int main(int, char *[]); # ifdef INTERNET @@ -424,6 +424,7 @@ list_drivers() u_long local_net; # endif int i; + unsigned j; static SOCKET *listv; static unsigned int listmax; unsigned int listc; @@ -539,11 +540,11 @@ get_response: * order since the port number *should* be in network * order: */ - for (i = 0; i < listc; i += 1) + for (j = 0; j < listc; j += 1) if (listv[listc].sin_addr.s_addr - == listv[i].sin_addr.s_addr) + == listv[j].sin_addr.s_addr) break; - if (i == listc) + if (j == listc) listv[listc++].sin_port = port_num; continue; } @@ -883,12 +884,10 @@ void fincurs() /* * leave: * Leave the game somewhat gracefully, restoring all current - * tty stats. + * tty stats, and print errno. */ void -leave(eval, mesg) - int eval; - char *mesg; +leave(int eval, const char *mesg) { int serrno = errno; fincurs(); @@ -897,14 +896,12 @@ leave(eval, mesg) } /* - * leave: + * leavex: * Leave the game somewhat gracefully, restoring all current * tty stats. */ void -leavex(eval, mesg) - int eval; - char *mesg; +leavex(int eval, const char *mesg) { fincurs(); errx(eval, mesg ? mesg : ""); diff --git a/hunt/hunt/playit.c b/hunt/hunt/playit.c index 56e1765f..815fbcba 100644 --- a/hunt/hunt/playit.c +++ b/hunt/hunt/playit.c @@ -1,4 +1,4 @@ -/* $NetBSD: playit.c,v 1.8 2004/01/27 20:30:29 jsm Exp $ */ +/* $NetBSD: playit.c,v 1.9 2008/01/28 03:23:29 dholland Exp $ */ /* * Copyright (c) 1983-2003, Regents of the University of California. * All rights reserved. @@ -32,7 +32,7 @@ #include #ifndef lint -__RCSID("$NetBSD: playit.c,v 1.8 2004/01/27 20:30:29 jsm Exp $"); +__RCSID("$NetBSD: playit.c,v 1.9 2008/01/28 03:23:29 dholland Exp $"); #endif /* not lint */ # include @@ -113,7 +113,7 @@ playit() bad_con(); /* NOTREACHED */ } - if (ntohl(version) != HUNT_VERSION) { + if (ntohl(version) != (u_int32_t)HUNT_VERSION) { bad_ver(); /* NOTREACHED */ } @@ -648,7 +648,7 @@ do_message() bad_con(); /* NOTREACHED */ } - if (ntohl(version) != HUNT_VERSION) { + if (ntohl(version) != (u_int32_t)HUNT_VERSION) { bad_ver(); /* NOTREACHED */ } diff --git a/hunt/huntd/answer.c b/hunt/huntd/answer.c index 0759f750..91307b3b 100644 --- a/hunt/huntd/answer.c +++ b/hunt/huntd/answer.c @@ -1,4 +1,4 @@ -/* $NetBSD: answer.c,v 1.8 2006/05/09 20:18:06 mrg Exp $ */ +/* $NetBSD: answer.c,v 1.9 2008/01/28 03:23:29 dholland Exp $ */ /* * Copyright (c) 1983-2003, Regents of the University of California. * All rights reserved. @@ -32,7 +32,7 @@ #include #ifndef lint -__RCSID("$NetBSD: answer.c,v 1.8 2006/05/09 20:18:06 mrg Exp $"); +__RCSID("$NetBSD: answer.c,v 1.9 2008/01/28 03:23:29 dholland Exp $"); #endif /* not lint */ # include @@ -56,8 +56,8 @@ answer() static char team; static int enter_status; static socklen_t socklen; - static u_long machine; - static u_int32_t uid; + static uint32_t machine; + static uint32_t uid; static SOCKET sockstruct; char *cp1, *cp2; int flags; @@ -92,7 +92,7 @@ answer() version = htonl((u_int32_t) HUNT_VERSION); (void) write(newsock, (char *) &version, LONGLEN); (void) read(newsock, (char *) &uid, LONGLEN); - uid = ntohl((unsigned long) uid); + uid = ntohl(uid); (void) read(newsock, name, NAMELEN); (void) read(newsock, &team, 1); (void) read(newsock, (char *) &enter_status, LONGLEN); @@ -375,8 +375,8 @@ rand_dir() */ IDENT * get_ident(machine, uid, name, team) - u_long machine; - u_long uid; + uint32_t machine; + uint32_t uid; char *name; char team; { diff --git a/hunt/huntd/draw.c b/hunt/huntd/draw.c index f7801fb5..2af7a2ad 100644 --- a/hunt/huntd/draw.c +++ b/hunt/huntd/draw.c @@ -1,4 +1,4 @@ -/* $NetBSD: draw.c,v 1.3 2003/06/11 12:00:22 wiz Exp $ */ +/* $NetBSD: draw.c,v 1.4 2008/01/28 03:23:29 dholland Exp $ */ /* * Copyright (c) 1983-2003, Regents of the University of California. * All rights reserved. @@ -32,7 +32,7 @@ #include #ifndef lint -__RCSID("$NetBSD: draw.c,v 1.3 2003/06/11 12:00:22 wiz Exp $"); +__RCSID("$NetBSD: draw.c,v 1.4 2008/01/28 03:23:29 dholland Exp $"); #endif /* not lint */ # include "hunt.h" @@ -262,13 +262,13 @@ check(pp, y, x) PLAYER *pp; int y, x; { - int index; + int indx; int ch; PLAYER *rpp; - index = y * sizeof Maze[0] + x; - ch = ((char *) Maze)[index]; - if (ch != ((char *) pp->p_maze)[index]) { + indx = y * sizeof Maze[0] + x; + ch = ((char *) Maze)[indx]; + if (ch != ((char *) pp->p_maze)[indx]) { rpp = pp; cgoto(rpp, y, x); if (x == rpp->p_x && y == rpp->p_y) @@ -277,7 +277,7 @@ check(pp, y, x) outch(rpp, player_sym(rpp, y, x)); else outch(rpp, ch); - ((char *) rpp->p_maze)[index] = ch; + ((char *) rpp->p_maze)[indx] = ch; } } @@ -353,7 +353,7 @@ drawplayer(pp, draw) void message(pp, s) PLAYER *pp; - char *s; + const char *s; { cgoto(pp, HEIGHT, 0); outstr(pp, s, strlen(s)); diff --git a/hunt/huntd/driver.c b/hunt/huntd/driver.c index 515e4d6d..f2c46789 100644 --- a/hunt/huntd/driver.c +++ b/hunt/huntd/driver.c @@ -1,4 +1,4 @@ -/* $NetBSD: driver.c,v 1.12 2006/10/07 17:27:57 elad Exp $ */ +/* $NetBSD: driver.c,v 1.13 2008/01/28 03:23:29 dholland Exp $ */ /* * Copyright (c) 1983-2003, Regents of the University of California. * All rights reserved. @@ -32,7 +32,7 @@ #include #ifndef lint -__RCSID("$NetBSD: driver.c,v 1.12 2006/10/07 17:27:57 elad Exp $"); +__RCSID("$NetBSD: driver.c,v 1.13 2008/01/28 03:23:29 dholland Exp $"); #endif /* not lint */ # include @@ -464,18 +464,18 @@ makeboots() * Check the damage to the given player, and see if s/he is killed */ void -checkdam(ouch, gotcha, credit, amt, shot_type) +checkdam(ouch, gotcha, credit, amt, this_shot_type) PLAYER *ouch, *gotcha; IDENT *credit; int amt; - char shot_type; + char this_shot_type; { - char *cp; + const char *cp; if (ouch->p_death[0] != '\0') return; # ifdef BOOTS - if (shot_type == SLIME) + if (this_shot_type == SLIME) switch (ouch->p_nboots) { default: break; @@ -497,7 +497,7 @@ checkdam(ouch, gotcha, credit, amt, shot_type) } /* Someone DIED */ - switch (shot_type) { + switch (this_shot_type) { default: cp = "Killed"; break; @@ -542,7 +542,7 @@ checkdam(ouch, gotcha, credit, amt, shot_type) } if (credit == NULL) { (void) sprintf(ouch->p_death, "| %s by %s |", cp, - (shot_type == MINE || shot_type == GMINE) ? + (this_shot_type == MINE || this_shot_type == GMINE) ? "a mine" : "act of God"); return; } diff --git a/hunt/huntd/execute.c b/hunt/huntd/execute.c index 36ee8b4f..5c59b32e 100644 --- a/hunt/huntd/execute.c +++ b/hunt/huntd/execute.c @@ -1,4 +1,4 @@ -/* $NetBSD: execute.c,v 1.4 2004/01/27 20:30:29 jsm Exp $ */ +/* $NetBSD: execute.c,v 1.5 2008/01/28 03:23:29 dholland Exp $ */ /* * Copyright (c) 1983-2003, Regents of the University of California. * All rights reserved. @@ -32,14 +32,14 @@ #include #ifndef lint -__RCSID("$NetBSD: execute.c,v 1.4 2004/01/27 20:30:29 jsm Exp $"); +__RCSID("$NetBSD: execute.c,v 1.5 2008/01/28 03:23:29 dholland Exp $"); #endif /* not lint */ # include # include "hunt.h" static void cloak(PLAYER *); -static void face(PLAYER *, int); +static void turn_player(PLAYER *, int); static void fire(PLAYER *, int); static void fire_slime(PLAYER *, int); static void move_player(PLAYER *, int); @@ -104,25 +104,25 @@ execute(pp) move_player(pp, LEFTS); break; case 'H': - face(pp, LEFTS); + turn_player(pp, LEFTS); break; case 'j': move_player(pp, BELOW); break; case 'J': - face(pp, BELOW); + turn_player(pp, BELOW); break; case 'k': move_player(pp, ABOVE); break; case 'K': - face(pp, ABOVE); + turn_player(pp, ABOVE); break; case 'l': move_player(pp, RIGHT); break; case 'L': - face(pp, RIGHT); + turn_player(pp, RIGHT); break; case 'f': case '1': @@ -324,11 +324,11 @@ move_player(pp, dir) } /* - * face: + * turn_player: * Change the direction the player is facing */ static void -face(pp, dir) +turn_player(pp, dir) PLAYER *pp; int dir; { diff --git a/hunt/huntd/hunt.h b/hunt/huntd/hunt.h index 0d061d14..20f33d41 100644 --- a/hunt/huntd/hunt.h +++ b/hunt/huntd/hunt.h @@ -1,4 +1,4 @@ -/* $NetBSD: hunt.h,v 1.11 2004/02/08 22:23:50 jsm Exp $ */ +/* $NetBSD: hunt.h,v 1.12 2008/01/28 03:23:29 dholland Exp $ */ /* * Copyright (c) 1983-2003, Regents of the University of California. @@ -290,8 +290,8 @@ typedef struct sockaddr_un SOCKET; struct ident_def { char i_name[NAMELEN]; char i_team; - long i_machine; - long i_uid; + uint32_t i_machine; + uint32_t i_uid; float i_kills; int i_entries; float i_score; @@ -370,7 +370,7 @@ extern FLAG Last_player; extern char Buf[BUFSIZ], Maze[HEIGHT][WIDTH2], Orig_maze[HEIGHT][WIDTH2]; -extern char *Driver; +extern const char *Driver; extern int Nplayer, Socket, Status; extern struct pollfd fdset[]; @@ -439,20 +439,20 @@ void execute(PLAYER *); void faketalk(void); void find_driver(FLAG); void fixshots(int, int, char); -IDENT *get_ident(u_long, u_long, char *, char); +IDENT *get_ident(uint32_t, uint32_t, char *, char); void get_local_name(char *); int get_remote_name(char *); BULLET *is_bullet(int, int); void look(PLAYER *); void makemaze(void); -void message(PLAYER *, char *); +void message(PLAYER *, const char *); void mon_execute(PLAYER *); void moveshots(void); void open_ctl(void); int opposite(int, char); void otto(int, int, char); void outch(PLAYER *, int); -void outstr(PLAYER *, char *, int); +void outstr(PLAYER *, const char *, int); int player_sym(PLAYER *, int, int); PLAYER *play_at(int, int); void playit(void); diff --git a/hunt/huntd/pathname.c b/hunt/huntd/pathname.c index 76cab204..b95d617d 100644 --- a/hunt/huntd/pathname.c +++ b/hunt/huntd/pathname.c @@ -1,4 +1,4 @@ -/* $NetBSD: pathname.c,v 1.3 2003/06/11 12:00:23 wiz Exp $ */ +/* $NetBSD: pathname.c,v 1.4 2008/01/28 03:23:29 dholland Exp $ */ /* * Copyright (c) 1983-2003, Regents of the University of California. * All rights reserved. @@ -32,7 +32,7 @@ #include #ifndef lint -__RCSID("$NetBSD: pathname.c,v 1.3 2003/06/11 12:00:23 wiz Exp $"); +__RCSID("$NetBSD: pathname.c,v 1.4 2008/01/28 03:23:29 dholland Exp $"); #endif /* not lint */ /* @@ -55,7 +55,7 @@ char *Stat_name = "/tmp/hunt.stats"; # else -char *Driver = HUNTD; +const char *Driver = HUNTD; # ifdef INTERNET u_short Test_port = ('h' << 8) | 't'; # else diff --git a/hunt/huntd/terminal.c b/hunt/huntd/terminal.c index 1b9c7be9..a54d61b1 100644 --- a/hunt/huntd/terminal.c +++ b/hunt/huntd/terminal.c @@ -1,4 +1,4 @@ -/* $NetBSD: terminal.c,v 1.4 2003/06/11 12:00:23 wiz Exp $ */ +/* $NetBSD: terminal.c,v 1.5 2008/01/28 03:23:29 dholland Exp $ */ /* * Copyright (c) 1983-2003, Regents of the University of California. * All rights reserved. @@ -32,7 +32,7 @@ #include #ifndef lint -__RCSID("$NetBSD: terminal.c,v 1.4 2003/06/11 12:00:23 wiz Exp $"); +__RCSID("$NetBSD: terminal.c,v 1.5 2008/01/28 03:23:29 dholland Exp $"); #endif /* not lint */ #include @@ -79,7 +79,7 @@ outch(pp, ch) void outstr(pp, str, len) PLAYER *pp; - char *str; + const char *str; int len; { pp->p_curx += len; -- cgit v1.2.3-56-ge451