sleep: support "inf"

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2019-01-07 15:20:56 +01:00
parent 4bdc914ff9
commit edca770d11
2 changed files with 5 additions and 1 deletions

View File

@ -68,6 +68,11 @@ int sleep_main(int argc UNUSED_PARAM, char **argv)
if (!*argv) if (!*argv)
bb_show_usage(); 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_FEATURE_FANCY_SLEEP
# if ENABLE_FLOAT_DURATION # if ENABLE_FLOAT_DURATION
/* undo busybox.c setlocale */ /* undo busybox.c setlocale */

View File

@ -7407,4 +7407,3 @@ int dc_main(int argc UNUSED_PARAM, char **argv)
#endif #endif
#endif // DC_BIG #endif // DC_BIG