aboutsummaryrefslogtreecommitdiff
path: root/coreutils/sleep.c
diff options
context:
space:
mode:
Diffstat (limited to 'coreutils/sleep.c')
-rw-r--r--coreutils/sleep.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/coreutils/sleep.c b/coreutils/sleep.c
index 6edff59cc..6fd00f9f1 100644
--- a/coreutils/sleep.c
+++ b/coreutils/sleep.c
@@ -17,14 +17,15 @@
17//config: default y 17//config: default y
18//config: help 18//config: help
19//config: sleep is used to pause for a specified number of seconds. 19//config: sleep is used to pause for a specified number of seconds.
20//config: It comes in 3 versions: 20//config: It comes in 2 versions:
21//config: - small: takes one integer parameter 21//config: - small: takes one integer parameter
22//config: - fancy: takes multiple integer arguments with suffixes: 22//config: - fancy:
23//config: sleep 1d 2h 3m 15s 23//config: * takes multiple integer arguments with suffixes:
24//config: - fancy with fractional numbers: 24//config: sleep 1d 2h 3m 15s
25//config: sleep 2.3s 4.5h sleeps for 16202.3 seconds 25//config: * allows fractional numbers:
26//config: Last one is "the most compatible" with coreutils sleep, 26//config: sleep 2.3s 4.5h sleeps for 16202.3 seconds
27//config: but it adds around 1k of code. 27//config: fancy is more compatible with coreutils sleep, but it adds around
28//config: 1k of code.
28//config: 29//config:
29//config:config FEATURE_FANCY_SLEEP 30//config:config FEATURE_FANCY_SLEEP
30//config: bool "Enable multiple arguments and s/m/h/d suffixes" 31//config: bool "Enable multiple arguments and s/m/h/d suffixes"
@@ -71,8 +72,8 @@ int sleep_main(int argc UNUSED_PARAM, char **argv)
71 * + we can't use bb_show_usage 72 * + we can't use bb_show_usage
72 * + applet_name can be the name of the shell 73 * + applet_name can be the name of the shell
73 */ 74 */
74 ++argv; 75 argv = skip_dash_dash(argv);
75 if (!*argv) { 76 if (!argv[0]) {
76 /* Without this, bare "sleep" in ash shows _ash_ --help */ 77 /* Without this, bare "sleep" in ash shows _ash_ --help */
77 /* (ash can be the "sh" applet as well, so check 2nd char) */ 78 /* (ash can be the "sh" applet as well, so check 2nd char) */
78 if (ENABLE_ASH_SLEEP && applet_name[1] != 'l') { 79 if (ENABLE_ASH_SLEEP && applet_name[1] != 'l') {