diff options
author | Charles Longeau <chl@cvs.openbsd.org> | 2007-09-14 14:29:21 +0000 |
---|---|---|
committer | Charles Longeau <chl@cvs.openbsd.org> | 2007-09-14 14:29:21 +0000 |
commit | 9f2d925dffdb4c245e7ccf857babe10c77b17518 (patch) | |
tree | 765ec3993a05497beaad5221beb15083f2b1d1f7 /games | |
parent | 8f00f23a2b0f39900bb1c2ab894a58e956979ffd (diff) |
remove some warnings:
unused variable `variable'
`variable' might be used uninitialized in this function
ok gilles@ ray@
Diffstat (limited to 'games')
-rw-r--r-- | games/atc/main.c | 8 | ||||
-rw-r--r-- | games/hack/hack.pager.c | 9 |
2 files changed, 8 insertions, 9 deletions
diff --git a/games/atc/main.c b/games/atc/main.c index ab15b9f3603..335ff78240b 100644 --- a/games/atc/main.c +++ b/games/atc/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.18 2007/09/11 15:21:05 gilles Exp $ */ +/* $OpenBSD: main.c,v 1.19 2007/09/14 14:29:20 chl Exp $ */ /* $NetBSD: main.c,v 1.4 1995/04/27 21:22:25 mycroft Exp $ */ /*- @@ -52,7 +52,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$OpenBSD: main.c,v 1.18 2007/09/11 15:21:05 gilles Exp $"; +static char rcsid[] = "$OpenBSD: main.c,v 1.19 2007/09/14 14:29:20 chl Exp $"; #endif #endif /* not lint */ @@ -257,7 +257,7 @@ default_game(void) { FILE *fp; static char file[256]; - char line[256], games[256], *p; + char line[256], games[256]; strlcpy(games, _PATH_GAMES, sizeof games); strlcat(games, GAMES, sizeof games); @@ -299,8 +299,6 @@ okay_game(const char *s) return (NULL); } while (fgets(line, sizeof(line), fp) != NULL) { - char *p; - line[strcspn(line, "\n")] = '\0'; if (strcmp(s, line) == 0) { if (strlen(line) + strlen(_PATH_GAMES) >= sizeof(file)) { diff --git a/games/hack/hack.pager.c b/games/hack/hack.pager.c index 953ab7677d5..ed0b224d32d 100644 --- a/games/hack/hack.pager.c +++ b/games/hack/hack.pager.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hack.pager.c,v 1.13 2007/09/11 15:21:05 gilles Exp $ */ +/* $OpenBSD: hack.pager.c,v 1.14 2007/09/14 14:29:20 chl Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -62,7 +62,7 @@ */ #ifndef lint -static const char rcsid[] = "$OpenBSD: hack.pager.c,v 1.13 2007/09/11 15:21:05 gilles Exp $"; +static const char rcsid[] = "$OpenBSD: hack.pager.c,v 1.14 2007/09/14 14:29:20 chl Exp $"; #endif /* not lint */ /* This file contains the command routine dowhatis() and a pager. */ @@ -97,7 +97,8 @@ dowhatis() if(q != '\t') while(fgets(buf,BUFSZ,fp)) if(*buf == q) { - buf[strcspn(buf, "\n")] = '\0'; + ep = strchr(buf, '\n'); + if(ep) *ep = 0; /* else: bad data file */ /* Expand tab 'by hand' */ if(buf[1] == '\t'){ @@ -136,7 +137,7 @@ intruph(int notused) static void page_more(FILE *fp, int strip) { - char *bufr, *ep; + char *bufr; sig_t prevsig = signal(SIGINT, intruph); set_pager(0); |