diff options
author | Philip Guenther <guenther@cvs.openbsd.org> | 2014-11-16 04:49:50 +0000 |
---|---|---|
committer | Philip Guenther <guenther@cvs.openbsd.org> | 2014-11-16 04:49:50 +0000 |
commit | f2273a76226705a4e8f5e015d1835449da4e3242 (patch) | |
tree | 9aa8ab3b6fae60c8e2a7a05923b9b6f239d3f864 /games/adventure | |
parent | 3243c629699c25f7f4a576fe1c2f58e274eba8f7 (diff) |
Eliminate pointless use of <sys/param.h>, <sys/file.h>, <sys/sockio.h>,
and <sys/ttydefaults.h>
Replace MAXPATHLEN with PATH_MAX and MAXLOGNAME with LOGIN_NAME_MAX
Pull in <limits.h> where needed
Prefer sizeof(var) over MAXFOO or FOO_MAX
ok deraadt@
Diffstat (limited to 'games/adventure')
-rw-r--r-- | games/adventure/main.c | 3 | ||||
-rw-r--r-- | games/adventure/wizard.c | 10 |
2 files changed, 6 insertions, 7 deletions
diff --git a/games/adventure/main.c b/games/adventure/main.c index 54f60eedebc..56318222bc2 100644 --- a/games/adventure/main.c +++ b/games/adventure/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.19 2009/10/27 23:59:23 deraadt Exp $ */ +/* $OpenBSD: main.c,v 1.20 2014/11/16 04:49:48 guenther Exp $ */ /* $NetBSD: main.c,v 1.5 1996/05/21 21:53:09 mrg Exp $ */ /*- @@ -37,7 +37,6 @@ /* Re-coding of advent in C: main program */ -#include <sys/file.h> #include <err.h> #include <signal.h> #include <stdio.h> diff --git a/games/adventure/wizard.c b/games/adventure/wizard.c index 55690443991..5255115834e 100644 --- a/games/adventure/wizard.c +++ b/games/adventure/wizard.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wizard.c,v 1.15 2013/08/22 04:43:41 guenther Exp $ */ +/* $OpenBSD: wizard.c,v 1.16 2014/11/16 04:49:48 guenther Exp $ */ /* $NetBSD: wizard.c,v 1.3 1995/04/24 12:21:41 cgd Exp $ */ /*- @@ -37,7 +37,7 @@ /* Re-coding of advent in C: privileged operations */ -#include <sys/param.h> +#include <limits.h> #include <stdio.h> #include <string.h> #include <stdlib.h> @@ -117,15 +117,15 @@ ciao(void) { int ch; char *c; - char fname[MAXPATHLEN]; + char fname[PATH_MAX]; printf("What would you like to call the saved version?\n"); - for (c = fname; c - fname < MAXPATHLEN; c++) { + for (c = fname; c - fname < sizeof(fname); c++) { if ((ch = getchar()) == '\n' || ch == EOF) break; *c = ch; } - if (c - fname == MAXPATHLEN) { + if (c - fname == sizeof(fname)) { c--; FLUSHLINE; } |