sbase

suckless unix tools
git clone git://git.2f30.org/sbase
Log | Files | Refs | README | LICENSE

commit fe3fc418380c3dae63a5da13376912f45599e5c3
parent f802a544e7a2b3cdf002c7c8a3625fbeacd48be3
Author: sin <sin@2f30.org>
Date:   Mon,  9 Feb 2015 16:01:25 +0000

tail: Fix tail -n -val to handle leading spaces

Previously 'tail -n "    -20" foo' was broken, now it works.

Diffstat:
Mtail.c | 3+--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/tail.c b/tail.c @@ -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;