summaryrefslogtreecommitdiff
path: root/src/tail.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1999-11-03 12:26:24 +0000
committerJim Meyering <jim@meyering.net>1999-11-03 12:26:24 +0000
commit23d439f22be3ab5ca09c728cdd483d9822283b29 (patch)
treea3a6dce9d9a6a1c84e484903eb4ba75df7a7e558 /src/tail.c
parentff220fd01212f9ce7cd416343d2cb91f41ffd4ac (diff)
downloadcoreutils-23d439f22be3ab5ca09c728cdd483d9822283b29.tar.xz
(anonymous enum) [RETRY_OPTION]: Define.
[MAX_UNCHANGED_STATS_OPTION]: Likewise. [MAX_CONSECUTIVE_SIZE_CHANGES_OPTION]: Likewise. [PID_OPTION]: Likewise. (long_options): Use *_OPTION instead of CHAR_MAX + N. (main): Likewise.
Diffstat (limited to 'src/tail.c')
-rw-r--r--src/tail.c29
1 files changed, 20 insertions, 9 deletions
diff --git a/src/tail.c b/src/tail.c
index c2a3ca4bb..48cefde05 100644
--- a/src/tail.c
+++ b/src/tail.c
@@ -186,19 +186,30 @@ static pid_t pid;
/* Nonzero if we have ever read standard input. */
static int have_read_stdin;
+/* For long options that have no equivalent short option, use a
+ non-character as a pseudo short option, starting with CHAR_MAX + 1. */
+enum
+{
+ RETRY_OPTION = CHAR_MAX + 1,
+ MAX_UNCHANGED_STATS_OPTION,
+ MAX_CONSECUTIVE_SIZE_CHANGES_OPTION,
+ PID_OPTION,
+};
+
static struct option const long_options[] =
{
/* --allow-missing is deprecated; use --retry instead
FIXME: remove it some day */
- {"allow-missing", no_argument, NULL, CHAR_MAX + 1},
+ {"allow-missing", no_argument, NULL, RETRY_OPTION},
{"bytes", required_argument, NULL, 'c'},
{"follow", optional_argument, NULL, 'f'},
{"lines", required_argument, NULL, 'n'},
- {"max-unchanged-stats", required_argument, NULL, CHAR_MAX + 2},
- {"max-consecutive-size-changes", required_argument, NULL, CHAR_MAX + 3},
- {"pid", required_argument, NULL, CHAR_MAX + 4},
+ {"max-unchanged-stats", required_argument, NULL, MAX_UNCHANGED_STATS_OPTION},
+ {"max-consecutive-size-changes", required_argument, NULL,
+ MAX_CONSECUTIVE_SIZE_CHANGES_OPTION},
+ {"pid", required_argument, NULL, PID_OPTION},
{"quiet", no_argument, NULL, 'q'},
- {"retry", no_argument, NULL, CHAR_MAX + 1},
+ {"retry", no_argument, NULL, RETRY_OPTION},
{"silent", no_argument, NULL, 'q'},
{"sleep-interval", required_argument, NULL, 's'},
{"verbose", no_argument, NULL, 'v'},
@@ -1348,11 +1359,11 @@ parse_options (int argc, char **argv,
follow_mode_string, follow_mode_map);
break;
- case CHAR_MAX + 1:
+ case RETRY_OPTION:
reopen_inaccessible_files = 1;
break;
- case CHAR_MAX + 2:
+ case MAX_UNCHANGED_STATS_OPTION:
/* --max-unchanged-stats=N */
if (xstrtoul (optarg, NULL, 10,
&max_n_unchanged_stats_between_opens, "") != LONGINT_OK)
@@ -1363,7 +1374,7 @@ parse_options (int argc, char **argv,
}
break;
- case CHAR_MAX + 3:
+ case MAX_CONSECUTIVE_SIZE_CHANGES_OPTION:
/* --max-consecutive-size-changes=N */
if (xstrtoul (optarg, NULL, 10,
&max_n_consecutive_size_changes_between_opens, "")
@@ -1375,7 +1386,7 @@ parse_options (int argc, char **argv,
}
break;
- case CHAR_MAX + 4:
+ case PID_OPTION:
{
strtol_error s_err;
unsigned long int tmp_ulong;