From: Sascha Wildner Date: Thu, 12 Jul 2012 11:41:23 +0000 (+0200) Subject: games: Fix -Werror for gcc47. X-Git-Tag: v3.2.0~598 X-Git-Url: http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/435f923e109adcc7b1ee7693c6981255e6bc7030 games: Fix -Werror for gcc47. * Remove unused variables and mark a few things __unused. * Properly use socklen_t. * Remove trek(6)'s undocumented -p option (which did nothing). --- diff --git a/games/adventure/io.c b/games/adventure/io.c index d454f62..e955949 100644 --- a/games/adventure/io.c +++ b/games/adventure/io.c @@ -564,7 +564,7 @@ void pspeak(int m, int skip) { char *s, nonfirst; - char *numst, ps_save; + char *numst; struct text *msg; char *tbuf; @@ -580,8 +580,8 @@ pspeak(int m, int skip) for (numst = s; (*s ^= *tape++) != TAB; s++) /* get number */ ; /* nothing */ - ps_save = *s; /* Temporarily trash the string (cringe) */ - *s++ = 0; /* decrypting number within the string */ + /* Temporarily trash the string (cringe) */ + *s++ = 0; /* decrypting number within the string */ if (atoi(numst) != 100 * skip && skip >= 0) { while ((*s++ ^ *tape++) != LF) /* flush the line */ diff --git a/games/backgammon/teachgammon/ttext2.c b/games/backgammon/teachgammon/ttext2.c index cddec42..3281a0722 100644 --- a/games/backgammon/teachgammon/ttext2.c +++ b/games/backgammon/teachgammon/ttext2.c @@ -28,7 +28,6 @@ * * @(#)ttext2.c 8.1 (Berkeley) 5/31/93 * $FreeBSD: src/games/backgammon/teachgammon/ttext2.c,v 1.3.2.1 2001/10/15 13:46:32 dd Exp $ - * $DragonFly: src/games/backgammon/teachgammon/ttext2.c,v 1.3 2006/08/08 16:36:11 pavalos Exp $ */ #include "back.h" @@ -123,14 +122,12 @@ const char *const lastch[] = { int text(const char *const *txt) { - const char *const *begin; const char *a; char b; const char *c; int i; fixtty(noech); - begin = txt; while (*txt) { a = *(txt++); if (*a != '\0') { @@ -182,7 +179,6 @@ text(const char *const *txt) fixtty(noech); if (tflag) curmove(curr, 0); - begin = txt; } } fixtty(raw); diff --git a/games/battlestar/fly.c b/games/battlestar/fly.c index a688c43..bd65fd5 100644 --- a/games/battlestar/fly.c +++ b/games/battlestar/fly.c @@ -240,7 +240,7 @@ blast(void) } static void -moveenemy(int sig) +moveenemy(__unused int sig) { double d; int oldr, oldc; diff --git a/games/hunt/hunt/list.c b/games/hunt/hunt/list.c index 52edfd7..d1e8b75 100644 --- a/games/hunt/hunt/list.c +++ b/games/hunt/hunt/list.c @@ -5,7 +5,6 @@ * This software is provided ``as is'' without express or implied warranty. * * $OpenBSD: list.c,v 1.5 2007/09/04 22:39:31 hshoexer Exp $ - * $DragonFly: src/games/hunt/hunt/list.c,v 1.2 2008/09/04 16:12:51 swildner Exp $ */ #include @@ -54,7 +53,8 @@ next_driver_fd(int fd) { fd_set r; int maxfd = -1; - int i, s, ret, len; + int i, s, ret; + socklen_t len; struct driver *driver; u_int16_t resp; diff --git a/games/rain/rain.c b/games/rain/rain.c index 9743173..6e87a17 100644 --- a/games/rain/rain.c +++ b/games/rain/rain.c @@ -29,7 +29,6 @@ * @(#) Copyright (c) 1980, 1993 The Regents of the University of California. All rights reserved. * @(#)rain.c 8.1 (Berkeley) 5/31/93 * $FreeBSD: src/games/rain/rain.c,v 1.8.2.1 2001/03/05 11:54:10 kris Exp $ - * $DragonFly: src/games/rain/rain.c,v 1.3 2003/11/12 14:53:54 eirikn Exp $ */ /* @@ -127,9 +126,7 @@ main(int argc, char **argv) } static void -onsig(int sig) +onsig(__unused int sig) { - - sig = 0; sig_caught = 1; } diff --git a/games/rogue/init.c b/games/rogue/init.c index 828762a..5b7d19d 100644 --- a/games/rogue/init.c +++ b/games/rogue/init.c @@ -80,7 +80,6 @@ boolean init(int argc, char *argv[]) { const char *pn; - int seed; pn = md_gln(); if ((!pn) || (strlen(pn) >= MAX_OPT_LEN)) { @@ -109,8 +108,7 @@ init(int argc, char *argv[]) if (score_only) { put_scores(NULL, 0); } - seed = md_gseed(); - srrandom(seed); + srandomdev(); if (rest_file) { restore(rest_file); return(1); diff --git a/games/rogue/machdep.c b/games/rogue/machdep.c index c3d2f23..291f430 100644 --- a/games/rogue/machdep.c +++ b/games/rogue/machdep.c @@ -31,7 +31,6 @@ * * @(#)machdep.c 8.1 (Berkeley) 5/31/93 * $FreeBSD: src/games/rogue/machdep.c,v 1.6.2.1 2001/12/17 12:43:23 phantom Exp $ - * $DragonFly: src/games/rogue/machdep.c,v 1.4 2006/09/09 02:21:49 pavalos Exp $ */ /* @@ -448,33 +447,6 @@ md_malloc(int n) return(t); } -/* md_gseed() (Get Seed) - * - * This function returns a seed for the random number generator (RNG). This - * seed causes the RNG to begin generating numbers at some point in its - * sequence. Without a random seed, the RNG will generate the same set - * of numbers, and every game will start out exactly the same way. A good - * number to use is the process id, given by getpid() on most UNIX systems. - * - * You need to find some single random integer, such as: - * process id. - * current time (minutes + seconds) returned from md_gct(), if implemented. - * - * It will not help to return "get_rand()" or "rand()" or the return value of - * any pseudo-RNG. If you don't have a random number, you can just return 1, - * but this means your games will ALWAYS start the same way, and will play - * exactly the same way given the same input. - */ - -int -md_gseed(void) -{ - time_t seconds; - - time(&seconds); - return((int)seconds); -} - /* md_exit(): * * This function causes the program to discontinue execution and exit. diff --git a/games/rogue/rogue.h b/games/rogue/rogue.h index 0e954a3..e1be13c 100644 --- a/games/rogue/rogue.h +++ b/games/rogue/rogue.h @@ -31,7 +31,6 @@ * * @(#)rogue.h 8.1 (Berkeley) 5/31/93 * $FreeBSD: src/games/rogue/rogue.h,v 1.3.2.1 2001/12/17 12:43:23 phantom Exp $ - * $DragonFly: src/games/rogue/rogue.h,v 1.4 2006/09/02 19:31:07 pavalos Exp $ */ #include @@ -443,7 +442,6 @@ struct rogue_time { /* external routine declarations. */ #define rrandom random -#define srrandom(x) srandomdev() /* hit.c */ void mon_hit(object *); @@ -505,7 +503,6 @@ const char *md_gln(void); void md_sleep(int); char *md_getenv(const char *); char *md_malloc(int); -int md_gseed(void); void md_exit(int); void md_lock(boolean); void md_shell(const char *); diff --git a/games/trek/main.c b/games/trek/main.c index 4a29560..13a688a 100644 --- a/games/trek/main.c +++ b/games/trek/main.c @@ -29,14 +29,11 @@ * @(#) Copyright (c) 1980, 1993 The Regents of the University of California. All rights reserved. * @(#)main.c 8.1 (Berkeley) 5/31/93 * $FreeBSD: src/games/trek/main.c,v 1.7.2.1 2001/03/05 12:11:14 kris Exp $ - * $DragonFly: src/games/trek/main.c,v 1.3 2006/09/07 21:19:44 pavalos Exp $ */ #include "trek.h" #include "getpar.h" -#define PRIO 00 /* default priority */ - unsigned int Mother = 51 + (51 << 8); /* @@ -143,9 +140,8 @@ main(int argc, char **argv) { #if 0 extern FILE *f_log; -#endif char opencode; - int prio; +#endif int ac; char **av; @@ -156,13 +152,15 @@ main(int argc, char **argv) ac = argc; av++; srandomdev(); +#if 0 opencode = 'w'; - prio = PRIO; - +#endif while (ac > 1 && av[0][0] == '-') { switch (av[0][1]) { case 'a': /* append to log file */ +#if 0 opencode = 'a'; +#endif break; #ifdef xTRACE @@ -172,13 +170,6 @@ main(int argc, char **argv) Trace++; break; #endif - - case 'p': /* set priority */ - if (getuid() != Mother) - goto badflag; - prio = atoi(av[0] + 2); - break; - default: badflag: printf("Invalid option: %s\n", av[0]);