aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-07-15 22:01:49 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-07-15 22:01:49 +0000
commit97faf531c81be075ecafb2ac83b17eae78cd2afb (patch)
treeb4e51950da0b124b808242d041927acabe11cc5d
parent5e476bab9c6db89dfadc94a8c4fbf3082339fecf (diff)
downloadbusybox-w32-97faf531c81be075ecafb2ac83b17eae78cd2afb.tar.gz
busybox-w32-97faf531c81be075ecafb2ac83b17eae78cd2afb.tar.bz2
busybox-w32-97faf531c81be075ecafb2ac83b17eae78cd2afb.zip
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 8d6192586..b01980d9a 100644
--- a/coreutils/Config.in
+++ b/coreutils/Config.in
@@ -509,18 +509,33 @@ config SHA1SUM
509 Compute and check SHA1 message digest 509 Compute and check SHA1 message digest
510 510
511config SLEEP 511config SLEEP
512 bool "sleep (single integer arg with no suffix)" 512 bool "sleep"
513 default n 513 default n
514 help 514 help
515 sleep is used to pause for a specified number of seconds, 515 sleep is used to pause for a specified number of seconds.
516 It comes in 3 versions:
517 - small: takes one integer parameter
518 - fancy: takes multiple integer arguments with suffixes:
519 sleep 1d 2h 3m 15s
520 - fancy with fractional numbers:
521 sleep 2.3s 4.5h sleeps for 16202.3 seconds
522 Last one is "the most compatible" with coreutils sleep,
523 but it adds around 1k of code.
516 524
517config FEATURE_FANCY_SLEEP 525config FEATURE_FANCY_SLEEP
518 bool "Enable multiple integer args and optional time suffixes" 526 bool "Enable multiple arguments and s/m/h/d suffixes"
519 default n 527 default n
520 depends on SLEEP 528 depends on SLEEP
521 help 529 help
522 Allow sleep to pause for specified minutes, hours, and days. 530 Allow sleep to pause for specified minutes, hours, and days.
523 531
532config FEATURE_FLOAT_SLEEP
533 bool "Enable fractional arguments"
534 default n
535 depends on FEATURE_FANCY_SLEEP
536 help
537 Allow for fractional numeric parameters.
538
524config SORT 539config SORT
525 bool "sort" 540 bool "sort"
526 default n 541 default n
@@ -532,7 +547,7 @@ config FEATURE_SORT_BIG
532 default y 547 default y
533 depends on SORT 548 depends on SORT
534 help 549 help
535 Without this, sort only supports -r, -u, and an integer version 550 Without this, sort only supports -r, -u, and an integer version
536 of -n. Selecting this adds sort keys, floating point support, and 551 of -n. Selecting this adds sort keys, floating point support, and
537 more. This adds a little over 3k to a nonstatic build on x86. 552 more. This adds a little over 3k to a nonstatic build on x86.
538 553
diff --git a/coreutils/sleep.c b/coreutils/sleep.c
index 93b178d76..de18dd0db 100644
--- a/coreutils/sleep.c
+++ b/coreutils/sleep.c
@@ -23,7 +23,7 @@
23/* This is a NOFORK applet. Be very careful! */ 23/* This is a NOFORK applet. Be very careful! */
24 24
25 25
26#if ENABLE_FEATURE_FANCY_SLEEP 26#if ENABLE_FEATURE_FANCY_SLEEP || ENABLE_FEATURE_FLOAT_SLEEP
27static const struct suffix_mult sfx[] = { 27static const struct suffix_mult sfx[] = {
28 { "s", 1 }, 28 { "s", 1 },
29 { "m", 60 }, 29 { "m", 60 },
@@ -36,7 +36,7 @@ static const struct suffix_mult sfx[] = {
36int sleep_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 36int sleep_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
37int sleep_main(int argc UNUSED_PARAM, char **argv) 37int sleep_main(int argc UNUSED_PARAM, char **argv)
38{ 38{
39#if ENABLE_FEATURE_FANCY_SLEEP && ENABLE_DESKTOP 39#if ENABLE_FEATURE_FLOAT_SLEEP
40 double duration; 40 double duration;
41 struct timespec ts; 41 struct timespec ts;
42#else 42#else
@@ -47,7 +47,7 @@ int sleep_main(int argc UNUSED_PARAM, char **argv)
47 if (!*argv) 47 if (!*argv)
48 bb_show_usage(); 48 bb_show_usage();
49 49
50#if ENABLE_FEATURE_FANCY_SLEEP && ENABLE_DESKTOP 50#if ENABLE_FEATURE_FLOAT_SLEEP
51 51
52 duration = 0; 52 duration = 0;
53 do { 53 do {
diff --git a/miscutils/Config.in b/miscutils/Config.in
index fae537b52..2a80e6148 100644
--- a/miscutils/Config.in
+++ b/miscutils/Config.in
@@ -342,7 +342,7 @@ config FEATURE_HDPARM_HDIO_UNREGISTER_HWIF
342 This is dangerous stuff, so you should probably say N. 342 This is dangerous stuff, so you should probably say N.
343 343
344config FEATURE_HDPARM_HDIO_DRIVE_RESET 344config FEATURE_HDPARM_HDIO_DRIVE_RESET
345 bool "perform device reset (DANGEROUS)" 345 bool "Perform device reset (DANGEROUS)"
346 default n 346 default n
347 depends on HDPARM 347 depends on HDPARM
348 help 348 help
@@ -350,7 +350,7 @@ config FEATURE_HDPARM_HDIO_DRIVE_RESET
350 This is dangerous stuff, so you should probably say N. 350 This is dangerous stuff, so you should probably say N.
351 351
352config FEATURE_HDPARM_HDIO_TRISTATE_HWIF 352config FEATURE_HDPARM_HDIO_TRISTATE_HWIF
353 bool "tristate device for hotswap (DANGEROUS)" 353 bool "Tristate device for hotswap (DANGEROUS)"
354 default n 354 default n
355 depends on HDPARM 355 depends on HDPARM
356 help 356 help
@@ -359,7 +359,7 @@ config FEATURE_HDPARM_HDIO_TRISTATE_HWIF
359 stuff, so you should probably say N. 359 stuff, so you should probably say N.
360 360
361config FEATURE_HDPARM_HDIO_GETSET_DMA 361config FEATURE_HDPARM_HDIO_GETSET_DMA
362 bool "get/set using_dma flag (DANGEROUS)" 362 bool "Get/set using_dma flag (DANGEROUS)"
363 default n 363 default n
364 depends on HDPARM 364 depends on HDPARM
365 help 365 help