[git commit] sleep: support "inf"
Denys Vlasenko
vda.linux at googlemail.com
Mon Jan 7 14:20:56 UTC 2019
commit: https://git.busybox.net/busybox/commit/?id=edca770d11edcc5b5548a62c068b2e75f1ccb54a
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master
Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
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
-
More information about the busybox-cvs
mailing list