From 1c04247f533ffb16e32b832a5ae2165b5e5abb9d Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Wed, 3 Nov 1999 13:06:50 +0000 Subject: [PATCH] Fix so that `tail -fn 2 file' works again. (anonymous enum) [LONG_FOLLOW_OPTION]: Define. (long_options): Use LONG_FOLLOW_OPTION here, instead of 'f'. (main): Remove the `::' after the `f' in getopt_long string. Add `case LONG_FOLLOW_OPTION' after `case 'f':'. Based on a patch from Tim Waugh. --- src/tail.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/tail.c b/src/tail.c index 48cefde056..8179f5c8b9 100644 --- a/src/tail.c +++ b/src/tail.c @@ -194,6 +194,7 @@ enum MAX_UNCHANGED_STATS_OPTION, MAX_CONSECUTIVE_SIZE_CHANGES_OPTION, PID_OPTION, + LONG_FOLLOW_OPTION, }; static struct option const long_options[] = @@ -202,7 +203,7 @@ static struct option const long_options[] = FIXME: remove it some day */ {"allow-missing", no_argument, NULL, RETRY_OPTION}, {"bytes", required_argument, NULL, 'c'}, - {"follow", optional_argument, NULL, 'f'}, + {"follow", optional_argument, NULL, LONG_FOLLOW_OPTION}, {"lines", required_argument, NULL, 'n'}, {"max-unchanged-stats", required_argument, NULL, MAX_UNCHANGED_STATS_OPTION}, {"max-consecutive-size-changes", required_argument, NULL, @@ -1312,7 +1313,7 @@ parse_options (int argc, char **argv, count_lines = 1; forever = from_start = print_headers = 0; - while ((c = getopt_long (argc, argv, "c:n:f::qs:v", long_options, NULL)) + while ((c = getopt_long (argc, argv, "c:n:fqs:v", long_options, NULL)) != -1) { switch (c) @@ -1351,6 +1352,7 @@ parse_options (int argc, char **argv, break; case 'f': + case LONG_FOLLOW_OPTION: forever = 1; if (optarg == NULL) follow_mode = DEFAULT_FOLLOW_MODE; -- 2.47.3