diff options
author | Jim Meyering <jim@meyering.net> | 1997-07-05 22:50:32 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 1997-07-05 22:50:32 +0000 |
commit | 08f38fd93040bb4a6f0c3fe333dccb6f58d66175 (patch) | |
tree | 48055a2d40f314ed0290afab881204e582d52ed2 /src | |
parent | 573588283f76f6c95f7344cf5919379642b9488d (diff) | |
download | coreutils-08f38fd93040bb4a6f0c3fe333dccb6f58d66175.tar.xz |
(parse_obsolescent_option): If POSIXLY_CORRECT is set, give
a diagnostic and fail when there are two or more non-option arguments.
Diffstat (limited to 'src')
-rw-r--r-- | src/tail.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/tail.c b/src/tail.c index e4b90e04e..0ca26b62f 100644 --- a/src/tail.c +++ b/src/tail.c @@ -88,7 +88,7 @@ /* Size of atomic reads. */ #ifndef BUFSIZ -#define BUFSIZ (512 * 8) +# define BUFSIZ (512 * 8) #endif /* If nonzero, interpret the numeric argument as the number of lines. @@ -875,7 +875,8 @@ parse_obsolescent_option (int argc, const char *const *argv, int t_forever; /* With the obsolescent form, there is one option string and - (technically) at most one file argument. But we allow two or more. */ + (technically) at most one file argument. But we allow two or more + by default. */ if (argc < 2) return 0; @@ -978,6 +979,20 @@ parse_obsolescent_option (int argc, const char *const *argv, { if (argc > 3) { + int posix_pedantic = (getenv ("POSIXLY_CORRECT") != NULL); + + /* When POSIXLY_CORRECT is set, enforce the `at most one + file argument' requirement. */ + if (posix_pedantic) + { + error (0, 0, _("\ +too many arguments; When using tail's obsolescent option syntax (%s)\n\ +there may be no more than one file argument. Use the equivalent -n or -c\n\ +option instead."), argv[1]); + *fail = 1; + return 1; + } + error (0, 0, _("\ Warning: it is not portable to use two or more file arguments with\n\ tail's obsolescent option syntax (%s). Use the equivalent -n or -c\n\ |