mirror of
https://github.com/sheumann/hush.git
synced 2024-09-12 00:55:11 +00:00
sleep: make fractional seconds separately selectable in .config
This commit is contained in:
parent
5e476bab9c
commit
97faf531c8
@ -509,18 +509,33 @@ config SHA1SUM
|
|||||||
Compute and check SHA1 message digest
|
Compute and check SHA1 message digest
|
||||||
|
|
||||||
config SLEEP
|
config SLEEP
|
||||||
bool "sleep (single integer arg with no suffix)"
|
bool "sleep"
|
||||||
default n
|
default n
|
||||||
help
|
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
|
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
|
default n
|
||||||
depends on SLEEP
|
depends on SLEEP
|
||||||
help
|
help
|
||||||
Allow sleep to pause for specified minutes, hours, and days.
|
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
|
config SORT
|
||||||
bool "sort"
|
bool "sort"
|
||||||
default n
|
default n
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
/* This is a NOFORK applet. Be very careful! */
|
/* 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[] = {
|
static const struct suffix_mult sfx[] = {
|
||||||
{ "s", 1 },
|
{ "s", 1 },
|
||||||
{ "m", 60 },
|
{ "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, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||||
int sleep_main(int argc UNUSED_PARAM, char **argv)
|
int sleep_main(int argc UNUSED_PARAM, char **argv)
|
||||||
{
|
{
|
||||||
#if ENABLE_FEATURE_FANCY_SLEEP && ENABLE_DESKTOP
|
#if ENABLE_FEATURE_FLOAT_SLEEP
|
||||||
double duration;
|
double duration;
|
||||||
struct timespec ts;
|
struct timespec ts;
|
||||||
#else
|
#else
|
||||||
@ -47,7 +47,7 @@ int sleep_main(int argc UNUSED_PARAM, char **argv)
|
|||||||
if (!*argv)
|
if (!*argv)
|
||||||
bb_show_usage();
|
bb_show_usage();
|
||||||
|
|
||||||
#if ENABLE_FEATURE_FANCY_SLEEP && ENABLE_DESKTOP
|
#if ENABLE_FEATURE_FLOAT_SLEEP
|
||||||
|
|
||||||
duration = 0;
|
duration = 0;
|
||||||
do {
|
do {
|
||||||
|
@ -342,7 +342,7 @@ config FEATURE_HDPARM_HDIO_UNREGISTER_HWIF
|
|||||||
This is dangerous stuff, so you should probably say N.
|
This is dangerous stuff, so you should probably say N.
|
||||||
|
|
||||||
config FEATURE_HDPARM_HDIO_DRIVE_RESET
|
config FEATURE_HDPARM_HDIO_DRIVE_RESET
|
||||||
bool "perform device reset (DANGEROUS)"
|
bool "Perform device reset (DANGEROUS)"
|
||||||
default n
|
default n
|
||||||
depends on HDPARM
|
depends on HDPARM
|
||||||
help
|
help
|
||||||
@ -350,7 +350,7 @@ config FEATURE_HDPARM_HDIO_DRIVE_RESET
|
|||||||
This is dangerous stuff, so you should probably say N.
|
This is dangerous stuff, so you should probably say N.
|
||||||
|
|
||||||
config FEATURE_HDPARM_HDIO_TRISTATE_HWIF
|
config FEATURE_HDPARM_HDIO_TRISTATE_HWIF
|
||||||
bool "tristate device for hotswap (DANGEROUS)"
|
bool "Tristate device for hotswap (DANGEROUS)"
|
||||||
default n
|
default n
|
||||||
depends on HDPARM
|
depends on HDPARM
|
||||||
help
|
help
|
||||||
@ -359,7 +359,7 @@ config FEATURE_HDPARM_HDIO_TRISTATE_HWIF
|
|||||||
stuff, so you should probably say N.
|
stuff, so you should probably say N.
|
||||||
|
|
||||||
config FEATURE_HDPARM_HDIO_GETSET_DMA
|
config FEATURE_HDPARM_HDIO_GETSET_DMA
|
||||||
bool "get/set using_dma flag (DANGEROUS)"
|
bool "Get/set using_dma flag (DANGEROUS)"
|
||||||
default n
|
default n
|
||||||
depends on HDPARM
|
depends on HDPARM
|
||||||
help
|
help
|
||||||
|
Loading…
Reference in New Issue
Block a user