From edca770d11edcc5b5548a62c068b2e75f1ccb54a Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Mon, 7 Jan 2019 15:20:56 +0100 Subject: [PATCH] sleep: support "inf" Signed-off-by: Denys Vlasenko --- coreutils/sleep.c | 5 +++++ miscutils/bc.c | 1 - 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/coreutils/sleep.c b/coreutils/sleep.c index 5c9cda9f0..7bfaab920 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 */ diff --git a/miscutils/bc.c b/miscutils/bc.c index 74884557a..bf174dafb 100644 --- a/miscutils/bc.c +++ b/miscutils/bc.c @@ -7407,4 +7407,3 @@ int dc_main(int argc UNUSED_PARAM, char **argv) #endif #endif // DC_BIG - -- 2.25.1