From edca770d11edcc5b5548a62c068b2e75f1ccb54a Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Mon, 7 Jan 2019 15:20:56 +0100 Subject: sleep: support "inf" Signed-off-by: Denys Vlasenko --- coreutils/sleep.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'coreutils/sleep.c') diff --git a/coreutils/sleep.c b/coreutils/sleep.c index 5c9cda9..7bfaab9 100644 --- a/coreutils/sleep.c +++ b/coreutils/sleep.c @@ -68,6 +68,11 @@ int sleep_main(int argc UNUSED_PARAM, char **argv) if (!*argv) bb_show_usage(); + /* GNU sleep accepts "inf", "INF", "infinity" and "INFINITY" */ + if (strncasecmp(argv[0], "inf", 3) == 0) + for (;;) + sleep(INT_MAX); + #if ENABLE_FEATURE_FANCY_SLEEP # if ENABLE_FLOAT_DURATION /* undo busybox.c setlocale */ -- cgit v1.1