summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1997-01-24 02:11:52 +0000
committerJim Meyering <jim@meyering.net>1997-01-24 02:11:52 +0000
commit50c04a9d3eaff68464906f321989ee152a06a926 (patch)
tree30ea49cdcd86b88c980cae127aa9f9fedfd7a001 /src
parent8a66d0dd57ce7f7eb7c2b37e1901621065fcbf84 (diff)
downloadcoreutils-50c04a9d3eaff68464906f321989ee152a06a926.tar.xz
(parse_obsolescent_option): Recognize and fail for
more malformed obsolescent options. Makes for better diagnostics.
Diffstat (limited to 'src')
-rw-r--r--src/tail.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/tail.c b/src/tail.c
index 153ce7048..0d59001fb 100644
--- a/src/tail.c
+++ b/src/tail.c
@@ -917,7 +917,22 @@ parse_obsolescent_option (int argc, const char *const *argv,
}
if (*p != '\0')
- return 0;
+ {
+ /* If (argv[1] begins with a `+' or if it begins with `-' followed
+ by a digit), but has an invalid suffix character, give a diagnostic
+ and indicate to caller that this *is* of the obsolescent form,
+ but that it's an invalid option. */
+ if (t_from_start || n_string)
+ {
+ error (0, 0,
+ _("%c: invalid suffix character in obsolescent option" ), *p);
+ *fail = 1;
+ return 1;
+ }
+
+ /* Otherwise, it might be a valid non-obsolescent option like -n. */
+ return 0;
+ }
*fail = 0;
if (n_string == NULL)