diff options
author | Jim Meyering <jim@meyering.net> | 1997-01-24 02:11:52 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 1997-01-24 02:11:52 +0000 |
commit | 50c04a9d3eaff68464906f321989ee152a06a926 (patch) | |
tree | 30ea49cdcd86b88c980cae127aa9f9fedfd7a001 /src/tail.c | |
parent | 8a66d0dd57ce7f7eb7c2b37e1901621065fcbf84 (diff) | |
download | coreutils-50c04a9d3eaff68464906f321989ee152a06a926.tar.xz |
(parse_obsolescent_option): Recognize and fail for
more malformed obsolescent options. Makes for better diagnostics.
Diffstat (limited to 'src/tail.c')
-rw-r--r-- | src/tail.c | 17 |
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) |