From: Jim Meyering Date: Fri, 24 Jan 1997 02:11:52 +0000 (+0000) Subject: (parse_obsolescent_option): Recognize and fail for X-Git-Tag: TEXTUTILS-1_21a~44 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=50c04a9d3eaff68464906f321989ee152a06a926;p=thirdparty%2Fcoreutils.git (parse_obsolescent_option): Recognize and fail for more malformed obsolescent options. Makes for better diagnostics. --- diff --git a/src/tail.c b/src/tail.c index 153ce70485..0d59001fbd 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)