diff options
author | Glenn L McGrath <bug1@ihug.co.nz> | 2002-12-23 11:54:56 +0000 |
---|---|---|
committer | Glenn L McGrath <bug1@ihug.co.nz> | 2002-12-23 11:54:56 +0000 |
commit | 76ff0da4d2b3127bcdcb5053377da4602d45e139 (patch) | |
tree | 0c01ace478b225ce9bc8b715d78b98015515b832 /coreutils | |
parent | c00c56e7c8d2446c2c91445afbaad77c3ee72175 (diff) | |
download | busybox-w32-76ff0da4d2b3127bcdcb5053377da4602d45e139.tar.gz busybox-w32-76ff0da4d2b3127bcdcb5053377da4602d45e139.tar.bz2 busybox-w32-76ff0da4d2b3127bcdcb5053377da4602d45e139.zip |
Support the obsolete '+' option
Diffstat (limited to 'coreutils')
-rw-r--r-- | coreutils/tail.c | 23 |
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) | |||
69 | char *s, *start, *end, buf[BUFSIZ]; | 69 | char *s, *start, *end, buf[BUFSIZ]; |
70 | int i, opt; | 70 | int i, opt; |
71 | 71 | ||
72 | if (( argc >= 2 ) && ( argv [1][0] == '-' ) && isdigit ( argv [1][1] )) { | 72 | if (argc >= 2) { |
73 | count = atoi ( &argv [1][1] ); | 73 | int line_num; |
74 | optind = 2; | 74 | switch (argv[1][0]) { |
75 | case '+': | ||
76 | from_top = 1; | ||
77 | /* FALLS THROUGH */ | ||
78 | case '-': | ||
79 | line_num = atoi(&argv[1][1]); | ||
80 | if (line_num != 0) { | ||
81 | optind = 2; | ||
82 | count = line_num; | ||
83 | } | ||
84 | break; | ||
85 | } | ||
75 | } | 86 | } |
76 | 87 | ||
77 | while ((opt = getopt(argc, argv, "c:fhn:q:s:v")) > 0) { | 88 | #ifdef CONFIG_FEATURE_FANCY_TAIL |
89 | while ((opt = getopt(argc, argv, "c:fn:q:s:v")) > 0) { | ||
90 | #else | ||
91 | while ((opt = getopt(argc, argv, "fn:")) > 0) { | ||
92 | #endif | ||
78 | switch (opt) { | 93 | switch (opt) { |
79 | case 'f': | 94 | case 'f': |
80 | follow = 1; | 95 | follow = 1; |