[hackers] [sbase] tail: Handle tail -n -val properly || sin

From: <git_AT_suckless.org>
Date: Mon, 9 Feb 2015 17:12:35 +0100 (CET)

commit 4b64cbff46bfb371186d0dafc0f48efab11c89cb
Author: sin <sin_AT_2f30.org>
Date: Mon Feb 9 15:52:31 2015 +0000

    tail: Handle tail -n -val properly

diff --git a/tail.c b/tail.c
index e244930..9f5bd4f 100644
--- a/tail.c
+++ b/tail.c
_AT_@ -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;
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:10 CET