Old style of saying "tail -n +123".
From 6ceb6f090dc7018e9a6d67dacbba9b74db34f418 Mon Sep 17 00:00:00 2001
From: Yi-Yo Chiang <[email protected]>
Date: Tue, 30 Aug 2022 17:39:10 +0800
Subject: [PATCH] Support tail +123
Old style of saying "tail -n +123".
Change-Id: Ifaf78eb1d8611536a9e3428081009a55aea4ce47
---
toys/posix/tail.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/toys/posix/tail.c b/toys/posix/tail.c
index 8a7d6d84..f9aabb32 100644
--- a/toys/posix/tail.c
+++ b/toys/posix/tail.c
@@ -289,8 +289,8 @@ void tail_main(void)
if (!FLAG(n) && !FLAG(c)) {
char *arg = *args;
- // handle old "-42" style arguments, else default to last 10 lines
- if (arg && *arg == '-' && arg[1]) {
+ // handle old "-42" / "+42" style arguments, else default to last 10 lines
+ if (arg && (*arg == '-' || *arg == '+') && arg[1]) {
TT.n = atolx(*(args++));
toys.optc--;
} else TT.n = -10;
--
2.37.2.672.g94769d06f0-goog
_______________________________________________
Toybox mailing list
[email protected]
http://lists.landley.net/listinfo.cgi/toybox-landley.net