tail: Fix tail -n -val to handle leading spaces
Previously 'tail -n " -20" foo' was broken, now it works.
This commit is contained in:
parent
f802a544e7
commit
fe3fc41838
3
tail.c
3
tail.c
|
@ -74,8 +74,7 @@ main(int argc, char *argv[])
|
||||||
break;
|
break;
|
||||||
case 'n':
|
case 'n':
|
||||||
lines = EARGF(usage());
|
lines = EARGF(usage());
|
||||||
n = estrtonum(lines[0] == '-' ? lines + 1 : lines,
|
n = MIN(llabs(estrtonum(lines, LLONG_MIN + 1, MIN(LLONG_MAX, SIZE_MAX))), SIZE_MAX);
|
||||||
0, MIN(LLONG_MAX, SIZE_MAX));
|
|
||||||
if (lines[0] == '+')
|
if (lines[0] == '+')
|
||||||
tail = dropinit;
|
tail = dropinit;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user