[hackers] [sbase] tail: Fix tail -n -val to handle leading spaces || sin
commit 91c859db36f609e5fa85924054c7cba3dc5daeab
Author: sin <sin_AT_2f30.org>
Date: Mon Feb 9 16:01:25 2015 +0000
tail: Fix tail -n -val to handle leading spaces
Previously 'tail -n " -20" foo' was broken, now it works.
diff --git a/tail.c b/tail.c
index 9f5bd4f..2265bac 100644
--- a/tail.c
+++ b/tail.c
_AT_@ -74,8 +74,7 @@ main(int argc, char *argv[])
break;
case 'n':
lines = EARGF(usage());
- n = estrtonum(lines[0] == '-' ? lines + 1 : lines,
- 0, MIN(LLONG_MAX, SIZE_MAX));
+ n = MIN(llabs(estrtonum(lines, LLONG_MIN + 1, MIN(LLONG_MAX, SIZE_MAX))), SIZE_MAX);
if (lines[0] == '+')
tail = dropinit;
break;
Received on Mon Feb 09 2015 - 17:12:35 CET
This archive was generated by hypermail 2.3.0
: Mon Feb 09 2015 - 17:24:12 CET