From e7000e01189d78586139d33cb3159585d9078e4c Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 31 Jan 2006 01:38:30 +0000 Subject: (main): Use a better diagnostic when someone uses a trailing numeric option in an invalid way. --- src/head.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src') 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); } } -- cgit v1.2.3-54-g00ecf