aboutsummaryrefslogtreecommitdiff
path: root/toys/posix/tail.c
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2016-04-16 08:19:23 -0700
committerRob Landley <rob@landley.net>2016-04-16 20:00:46 -0500
commite57cb179608077b7459b95bb3219035dd0045912 (patch)
tree37df168a1ef79a57ebf85af0731e48e3ec98495b /toys/posix/tail.c
parent00a60fcaa318a437ab66d9a6bd6c065a019a8fad (diff)
downloadtoybox-e57cb179608077b7459b95bb3219035dd0045912.tar.gz
Fix tail -NUM again.
This time with a test.
Diffstat (limited to 'toys/posix/tail.c')
-rw-r--r--toys/posix/tail.c6
1 files changed, 3 insertions, 3 deletions
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