(main): Manually handle `--', since we no longer
authorJim Meyering <jim@meyering.net>
Sat, 1 May 1999 02:29:17 +0000 (02:29 +0000)
committerJim Meyering <jim@meyering.net>
Sat, 1 May 1999 02:29:17 +0000 (02:29 +0000)
call getopt.  Reported by Joseph S. Myers.

src/basename.c

index 802c5dc..ffdb675 100644 (file)
@@ -100,6 +100,13 @@ main (int argc, char **argv)
 
   parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
                      AUTHORS, usage);
+  /* The above handles --help and --version.
+     Since there is no other invocation of getopt, handle `--' here.  */
+  if (argc > 1 && STREQ (argv[1], "--"))
+    {
+      --argc;
+      ++argv;
+    }
 
   if (argc == 1 || argc > 3)
     {