Unix argcheck() usage

The checking for command line flags --version, --showpath, and one
or two others was inside #if CHDIR.  I don't know whether anyone
ever disables that configuration option, but it shouldn't control
whether those flags are handled.
This commit is contained in:
PatR
2022-02-14 11:18:08 -08:00
parent e4910890ed
commit 47c1df6e6f
+4 -2
View File
@@ -1,4 +1,4 @@
/* NetHack 3.7 unixmain.c $NHDT-Date: 1605493691 2020/11/16 02:28:11 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.90 $ */ /* NetHack 3.7 unixmain.c $NHDT-Date: 1644866265 2022/02/14 19:17:45 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.96 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2011. */ /*-Copyright (c) Robert Patrick Rankin, 2011. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -49,7 +49,7 @@ int
main(int argc, char *argv[]) main(int argc, char *argv[])
{ {
#ifdef CHDIR #ifdef CHDIR
register char *dir; char *dir;
#endif #endif
NHFILE *nhfp; NHFILE *nhfp;
boolean exact_username; boolean exact_username;
@@ -107,6 +107,7 @@ main(int argc, char *argv[])
dir = nh_getenv("NETHACKDIR"); dir = nh_getenv("NETHACKDIR");
if (!dir) if (!dir)
dir = nh_getenv("HACKDIR"); dir = nh_getenv("HACKDIR");
#endif /* CHDIR */
if (argc > 1) { if (argc > 1) {
if (argcheck(argc, argv, ARG_VERSION) == 2) if (argcheck(argc, argv, ARG_VERSION) == 2)
@@ -130,6 +131,7 @@ main(int argc, char *argv[])
argc--; argc--;
argv++; argv++;
} }
#ifdef CHDIR
if (argc > 1 && !strncmp(argv[1], "-d", 2) && argv[1][2] != 'e') { if (argc > 1 && !strncmp(argv[1], "-d", 2) && argv[1][2] != 'e') {
/* avoid matching "-dec" for DECgraphics; since the man page /* avoid matching "-dec" for DECgraphics; since the man page
* says -d directory, hope nobody's using -desomething_else * says -d directory, hope nobody's using -desomething_else