]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
(main): Handle "--".
authorJim Meyering <jim@meyering.net>
Thu, 17 Jun 2004 13:09:21 +0000 (13:09 +0000)
committerJim Meyering <jim@meyering.net>
Thu, 17 Jun 2004 13:09:21 +0000 (13:09 +0000)
src/chroot.c
src/hostid.c
src/hostname.c
src/pwd.c
src/sync.c

index 5a28e32c445c98e486470364d090972c5684c2d1..3d196af6eb2f612c3a99be7446935d1fc459bc65 100644 (file)
@@ -75,6 +75,15 @@ main (int argc, char **argv)
 
   parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
                      usage, AUTHORS, (char const *) NULL);
+
+  /* The above handles --help and --version.
+     Since there is no other invocation of getopt, handle `--' here.  */
+  if (1 < argc && STREQ (argv[1], "--"))
+    {
+      --argc;
+      ++argv;
+    }
+
   if (argc <= 1)
     {
       error (0, 0, _("too few arguments"));
index 095b758917ec792de6f783c7230d10cb39f9db10..a262e787483b186cb57b4735e9ad4b29c106e115 100644 (file)
@@ -73,6 +73,14 @@ main (int argc, char **argv)
   parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
                      usage, AUTHORS, (char const *) NULL);
 
+  /* The above handles --help and --version.
+     Since there is no other invocation of getopt, handle `--' here.  */
+  if (1 < argc && STREQ (argv[1], "--"))
+    {
+      --argc;
+      ++argv;
+    }
+
   if (argc > 1)
     {
       error (0, 0, _("too many arguments"));
index c9b62e446a074f10bf09e3b1fa4133d79c692440..ff7b4e4cc031a328e1d466cd8e051f94b41afc5c 100644 (file)
@@ -97,6 +97,14 @@ main (int argc, char **argv)
   parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
                      usage, AUTHORS, (char const *) NULL);
 
+  /* The above handles --help and --version.
+     Since there is no other invocation of getopt, handle `--' here.  */
+  if (1 < argc && STREQ (argv[1], "--"))
+    {
+      --argc;
+      ++argv;
+    }
+
 #ifdef HAVE_SETHOSTNAME
   if (argc == 2)
     {
index 46868920088ff784c0d3392ee129f76ebf6ada81..6c64be74046981b7830c3bfe71d570f0f49b97fb 100644 (file)
--- a/src/pwd.c
+++ b/src/pwd.c
@@ -306,6 +306,14 @@ main (int argc, char **argv)
   parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
                      usage, AUTHORS, (char const *) NULL);
 
+  /* The above handles --help and --version.
+     Since there is no other invocation of getopt, handle `--' here.  */
+  if (1 < argc && STREQ (argv[1], "--"))
+    {
+      --argc;
+      ++argv;
+    }
+
   if (1 < argc)
     error (0, 0, _("ignoring non-option arguments"));
 
index 7dbbc55669efdd81693ec9b568b011f764abbccb..045b820c24bb1b7d48093891f2370425e5cf6abb 100644 (file)
@@ -67,6 +67,14 @@ main (int argc, char **argv)
   parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE, VERSION,
                      usage, AUTHORS, (char const *) NULL);
 
+  /* The above handles --help and --version.
+     Since there is no other invocation of getopt, handle `--' here.  */
+  if (1 < argc && STREQ (argv[1], "--"))
+    {
+      --argc;
+      ++argv;
+    }
+
   if (1 < argc)
     error (0, 0, _("ignoring all arguments"));