commit f802a544e7a2b3cdf002c7c8a3625fbeacd48be3
parent a5cc60f2e0efc69c2c80c046ab18e4370bbdff51
Author: sin <sin@2f30.org>
Date: Mon, 9 Feb 2015 15:52:31 +0000
tail: Handle tail -n -val properly
Diffstat:
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tail.c b/tail.c
@@ -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;