From f2273a76226705a4e8f5e015d1835449da4e3242 Mon Sep 17 00:00:00 2001 From: Philip Guenther Date: Sun, 16 Nov 2014 04:49:50 +0000 Subject: Eliminate pointless use of , , , and Replace MAXPATHLEN with PATH_MAX and MAXLOGNAME with LOGIN_NAME_MAX Pull in where needed Prefer sizeof(var) over MAXFOO or FOO_MAX ok deraadt@ --- games/adventure/main.c | 3 +-- games/adventure/wizard.c | 10 +++++----- 2 files changed, 6 insertions(+), 7 deletions(-) (limited to 'games/adventure') 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 #include #include #include 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 +#include #include #include #include @@ -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; } -- cgit v1.2.3