]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
(parse_options): Use a better diagnostic when someone uses a trailing
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 31 Jan 2006 01:39:10 +0000 (01:39 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Tue, 31 Jan 2006 01:39:10 +0000 (01:39 +0000)
numeric option in an invalid way.

src/tail.c

index 1bfe4bb30633a4428350c161030bf6840b23149d..1718a77297c5053341d96f79cf4ffdc922fb46fa 100644 (file)
@@ -1455,7 +1455,8 @@ parse_options (int argc, char **argv,
 {
   int c;
 
-  while ((c = getopt_long (argc, argv, "c:n:fFqs:v", long_options, NULL))
+  while ((c = getopt_long (argc, argv, "c:n:fFqs:v0123456789",
+                          long_options, NULL))
         != -1)
     {
       switch (c)
@@ -1553,6 +1554,11 @@ parse_options (int argc, char **argv,
 
        case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
 
+       case '0': case '1': case '2': case '3': case '4':
+       case '5': case '6': case '7': case '8': case '9':
+         error (EXIT_FAILURE, 0,
+                _("option used in invalid context -- %c"), c);
+
        default:
          usage (EXIT_FAILURE);
        }