summaryrefslogtreecommitdiff
path: root/src/head.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2006-01-31 01:38:30 +0000
committerPaul Eggert <eggert@cs.ucla.edu>2006-01-31 01:38:30 +0000
commite7000e01189d78586139d33cb3159585d9078e4c (patch)
tree2186357aa0ea264bf8e5a46771837cada8a171be /src/head.c
parent251468f113b0350679404e3bf261ecbb30dbeb27 (diff)
downloadcoreutils-e7000e01189d78586139d33cb3159585d9078e4c.tar.xz
(main): Use a better diagnostic when someone uses a
trailing numeric option in an invalid way.
Diffstat (limited to 'src/head.c')
-rw-r--r--src/head.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/head.c b/src/head.c
index 95100250d..4038722b0 100644
--- a/src/head.c
+++ b/src/head.c
@@ -1,5 +1,5 @@
/* head -- output first part of file(s)
- Copyright (C) 89, 90, 91, 1995-2005 Free Software Foundation, Inc.
+ Copyright (C) 89, 90, 91, 1995-2006 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -973,7 +973,7 @@ main (int argc, char **argv)
break;
default:
- error (0, 0, _("unrecognized option `-%c'"), *a);
+ error (0, 0, _("invalid trailing option -- %c"), *a);
usage (EXIT_FAILURE);
}
}
@@ -992,7 +992,8 @@ main (int argc, char **argv)
argc--;
}
- while ((c = getopt_long (argc, argv, "c:n:qv", long_options, NULL)) != -1)
+ while ((c = getopt_long (argc, argv, "c:n:qv0123456789", long_options, NULL))
+ != -1)
{
switch (c)
{
@@ -1029,6 +1030,8 @@ main (int argc, char **argv)
case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
default:
+ if (ISDIGIT (c))
+ error (0, 0, _("invalid trailing option -- %c"), c);
usage (EXIT_FAILURE);
}
}