summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko2008-07-15 22:01:49 +0000
committerDenis Vlasenko2008-07-15 22:01:49 +0000
commit97faf531c81be075ecafb2ac83b17eae78cd2afb (patch)
treeb4e51950da0b124b808242d041927acabe11cc5d
parent5e476bab9c6db89dfadc94a8c4fbf3082339fecf (diff)
downloadbusybox-97faf531c81be075ecafb2ac83b17eae78cd2afb.zip
busybox-97faf531c81be075ecafb2ac83b17eae78cd2afb.tar.gz
sleep: make fractional seconds separately selectable in .config
-rw-r--r--coreutils/Config.in23
-rw-r--r--coreutils/sleep.c6
-rw-r--r--miscutils/Config.in6
3 files changed, 25 insertions, 10 deletions
diff --git a/coreutils/Config.in b/coreutils/Config.in
index 8d61925..b01980d 100644
--- a/coreutils/Config.in
+++ b/coreutils/Config.in
@@ -509,18 +509,33 @@ config SHA1SUM
Compute and check SHA1 message digest
config SLEEP
- bool "sleep (single integer arg with no suffix)"
+ bool "sleep"
default n
help
- sleep is used to pause for a specified number of seconds,
+ sleep is used to pause for a specified number of seconds.
+ It comes in 3 versions:
+ - small: takes one integer parameter
+ - fancy: takes multiple integer arguments with suffixes:
+ sleep 1d 2h 3m 15s
+ - fancy with fractional numbers:
+ sleep 2.3s 4.5h sleeps for 16202.3 seconds
+ Last one is "the most compatible" with coreutils sleep,
+ but it adds around 1k of code.
config FEATURE_FANCY_SLEEP
- bool "Enable multiple integer args and optional time suffixes"
+ bool "Enable multiple arguments and s/m/h/d suffixes"
default n
depends on SLEEP
help
Allow sleep to pause for specified minutes, hours, and days.
+config FEATURE_FLOAT_SLEEP
+ bool "Enable fractional arguments"
+ default n
+ depends on FEATURE_FANCY_SLEEP
+ help
+ Allow for fractional numeric parameters.
+
config SORT
bool "sort"
default n
@@ -532,7 +547,7 @@ config FEATURE_SORT_BIG
default y
depends on SORT
help
- Without this, sort only supports -r, -u, and an integer version
+ Without this, sort only supports -r, -u, and an integer version
of -n. Selecting this adds sort keys, floating point support, and
more. This adds a little over 3k to a nonstatic build on x86.
diff --git a/coreutils/sleep.c b/coreutils/sleep.c
index 93b178d..de18dd0 100644
--- a/coreutils/sleep.c
+++ b/coreutils/sleep.c
@@ -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 @@ static const struct suffix_mult sfx[] = {
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 @@ int sleep_main(int argc UNUSED_PARAM, char **argv)
if (!*argv)
bb_show_usage();
-#if ENABLE_FEATURE_FANCY_SLEEP && ENABLE_DESKTOP
+#if ENABLE_FEATURE_FLOAT_SLEEP
duration = 0;
do {
diff --git a/miscutils/Config.in b/miscutils/Config.in
index fae537b..2a80e61 100644
--- a/miscutils/Config.in
+++ b/miscutils/Config.in
@@ -342,7 +342,7 @@ config FEATURE_HDPARM_HDIO_UNREGISTER_HWIF
This is dangerous stuff, so you should probably say N.
config FEATURE_HDPARM_HDIO_DRIVE_RESET
- bool "perform device reset (DANGEROUS)"
+ bool "Perform device reset (DANGEROUS)"
default n
depends on HDPARM
help
@@ -350,7 +350,7 @@ config FEATURE_HDPARM_HDIO_DRIVE_RESET
This is dangerous stuff, so you should probably say N.
config FEATURE_HDPARM_HDIO_TRISTATE_HWIF
- bool "tristate device for hotswap (DANGEROUS)"
+ bool "Tristate device for hotswap (DANGEROUS)"
default n
depends on HDPARM
help
@@ -359,7 +359,7 @@ config FEATURE_HDPARM_HDIO_TRISTATE_HWIF
stuff, so you should probably say N.
config FEATURE_HDPARM_HDIO_GETSET_DMA
- bool "get/set using_dma flag (DANGEROUS)"
+ bool "Get/set using_dma flag (DANGEROUS)"
default n
depends on HDPARM
help