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

From: <git_AT_suckless.org>
Date: Tue, 24 Mar 2015 23:53:39 +0100 (CET)

commit f802a544e7a2b3cdf002c7c8a3625fbeacd48be3
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 Tue Mar 24 2015 - 23:53:39 CET

This archive was generated by hypermail 2.3.0 : Wed Mar 25 2015 - 00:08:36 CET