]> granicus.if.org Git - nethack/commitdiff
Unix argcheck() usage
authorPatR <rankin@nethack.org>
Mon, 14 Feb 2022 19:18:08 +0000 (11:18 -0800)
committerPatR <rankin@nethack.org>
Mon, 14 Feb 2022 19:18:08 +0000 (11:18 -0800)
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.

sys/unix/unixmain.c

index ef27160c04efdebbc602dd5e13d2127a961ba827..8ba7321292f23a95dcb73e44e13f1425b9497514 100644 (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) Robert Patrick Rankin, 2011. */
 /* NetHack may be freely redistributed.  See license for details. */
@@ -49,7 +49,7 @@ int
 main(int argc, char *argv[])
 {
 #ifdef CHDIR
-    register char *dir;
+    char *dir;
 #endif
     NHFILE *nhfp;
     boolean exact_username;
@@ -107,6 +107,7 @@ main(int argc, char *argv[])
     dir = nh_getenv("NETHACKDIR");
     if (!dir)
         dir = nh_getenv("HACKDIR");
+#endif /* CHDIR */
 
     if (argc > 1) {
         if (argcheck(argc, argv, ARG_VERSION) == 2)
@@ -130,6 +131,7 @@ main(int argc, char *argv[])
             argc--;
             argv++;
         }
+#ifdef CHDIR
         if (argc > 1 && !strncmp(argv[1], "-d", 2) && argv[1][2] != 'e') {
             /* avoid matching "-dec" for DECgraphics; since the man page
              * says -d directory, hope nobody's using -desomething_else