Support the obsolete '+' option
This commit is contained in:
@@ -69,12 +69,27 @@ int tail_main(int argc, char **argv)
|
|||||||
char *s, *start, *end, buf[BUFSIZ];
|
char *s, *start, *end, buf[BUFSIZ];
|
||||||
int i, opt;
|
int i, opt;
|
||||||
|
|
||||||
if (( argc >= 2 ) && ( argv [1][0] == '-' ) && isdigit ( argv [1][1] )) {
|
if (argc >= 2) {
|
||||||
count = atoi ( &argv [1][1] );
|
int line_num;
|
||||||
optind = 2;
|
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) {
|
switch (opt) {
|
||||||
case 'f':
|
case 'f':
|
||||||
follow = 1;
|
follow = 1;
|
||||||
|
Reference in New Issue
Block a user