From e57cb179608077b7459b95bb3219035dd0045912 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Sat, 16 Apr 2016 08:19:23 -0700 Subject: Fix tail -NUM again. This time with a test. --- toys/posix/tail.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'toys') diff --git a/toys/posix/tail.c b/toys/posix/tail.c index 1204f1c6..787e116e 100644 --- a/toys/posix/tail.c +++ b/toys/posix/tail.c @@ -231,10 +231,10 @@ void tail_main(void) if (arg && *arg == '-' && arg[1]) { TT.lines = atolx(*(args++)); toys.optc--; + } else { + // if nothing specified, default -n to -10 + TT.lines = -10; } - - // if nothing specified, default -n to -10 - TT.lines = -10; } // Allocate 2 ints per optarg for -f -- cgit v1.2.3