summaryrefslogtreecommitdiffhomepage
path: root/coreutils
diff options
context:
space:
mode:
authorGlenn L McGrath <bug1@ihug.co.nz>2002-12-23 11:54:56 +0000
committerGlenn L McGrath <bug1@ihug.co.nz>2002-12-23 11:54:56 +0000
commit76ff0da4d2b3127bcdcb5053377da4602d45e139 (patch)
tree0c01ace478b225ce9bc8b715d78b98015515b832 /coreutils
parentc00c56e7c8d2446c2c91445afbaad77c3ee72175 (diff)
Support the obsolete '+' option
Diffstat (limited to 'coreutils')
-rw-r--r--coreutils/tail.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/coreutils/tail.c b/coreutils/tail.c
index 024441e73..1703eefc6 100644
--- a/coreutils/tail.c
+++ b/coreutils/tail.c
@@ -69,12 +69,27 @@ int tail_main(int argc, char **argv)
char *s, *start, *end, buf[BUFSIZ];
int i, opt;
- if (( argc >= 2 ) && ( argv [1][0] == '-' ) && isdigit ( argv [1][1] )) {
- count = atoi ( &argv [1][1] );
- optind = 2;
+ if (argc >= 2) {
+ int line_num;
+ switch (argv[1][0]) {
+ case '+':
+ from_top = 1;
+ /* FALLS THROUGH */
+ case '-':
+ line_num = atoi(&argv[1][1]);
+ if (line_num != 0) {
+ optind = 2;
+ count = line_num;
+ }
+ break;
+ }
}
- while ((opt = getopt(argc, argv, "c:fhn:q:s:v")) > 0) {
+#ifdef CONFIG_FEATURE_FANCY_TAIL
+ while ((opt = getopt(argc, argv, "c:fn:q:s:v")) > 0) {
+#else
+ while ((opt = getopt(argc, argv, "fn:")) > 0) {
+#endif
switch (opt) {
case 'f':
follow = 1;