tail: Handle tail -n -val properly

This commit is contained in:
sin 2015-02-09 15:52:31 +00:00
parent a5cc60f2e0
commit f802a544e7

3
tail.c
View File

@ -74,7 +74,8 @@ main(int argc, char *argv[])
break;
case 'n':
lines = EARGF(usage());
n = estrtonum(lines, 0, MIN(LLONG_MAX, SIZE_MAX));
n = estrtonum(lines[0] == '-' ? lines + 1 : lines,
0, MIN(LLONG_MAX, SIZE_MAX));
if (lines[0] == '+')
tail = dropinit;
break;