This is a patch that implements a config option for the
fractional sleep arguments.
Hope this helps,
Loïc
Index: coreutils/sleep.c
===================================================================
--- coreutils/sleep.c (révision 22832)
+++ coreutils/sleep.c (copie de travail)
@@ -23,7 +23,7 @@
/* This is a NOFORK applet. Be very careful! */
-#if ENABLE_FEATURE_FANCY_SLEEP
+#if ENABLE_FEATURE_FANCY_SLEEP && !ENABLE_FEATURE_FLOAT_SLEEP
static const struct suffix_mult sfx[] = {
{ "s", 1 },
{ "m", 60 },
@@ -36,7 +36,7 @@
int sleep_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int sleep_main(int argc UNUSED_PARAM, char **argv)
{
-#if ENABLE_FEATURE_FANCY_SLEEP && ENABLE_DESKTOP
+#if ENABLE_FEATURE_FLOAT_SLEEP
double duration;
struct timespec ts;
#else
@@ -47,7 +47,7 @@
if (!*argv)
bb_show_usage();
-#if ENABLE_FEATURE_FANCY_SLEEP && ENABLE_DESKTOP
+#if ENABLE_FEATURE_FLOAT_SLEEP
duration = 0;
do {
Index: coreutils/Config.in
===================================================================
--- coreutils/Config.in (révision 22832)
+++ coreutils/Config.in (copie de travail)
@@ -514,13 +514,35 @@
help
sleep is used to pause for a specified number of seconds,
+choice
+ prompt "Options for sleep"
+ default FEATURE_SMALL_SLEEP
+ help
+ sleep comes in 3 versions:
+ - The small one with no fancy features.
+ - The fancy one which allows multiple arguments with time suffixes:
+ sleep 1d 2h 3m 15s will sleep for 1 day 2 hours 3 minutes and
+ 15 seconds.
+ - The floating one which allows multiple fractional time:
+ sleep 2.3 4.5 will sleep for 6.8 seconds.
+
+config FEATURE_SMALL_SLEEP
+ bool "Small sleep"
+ help
+ Most compact version of sleep.
+
config FEATURE_FANCY_SLEEP
bool "Enable multiple integer args and optional time suffixes"
- default n
- depends on SLEEP
help
Allow sleep to pause for specified minutes, hours, and days.
+config FEATURE_FLOAT_SLEEP
+ bool "Enable multiple fractional arguments"
+ help
+ Allow sleep to pause for non integer time.
+
+endchoice
+
config SORT
bool "sort"
default n
_______________________________________________
busybox mailing list
[email protected]
http://busybox.net/cgi-bin/mailman/listinfo/busybox