diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2016-11-23 14:46:56 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2016-11-23 14:46:56 +0100 |
commit | af3f42011628585cd5c8f5c1fd4b43f2e370a23d (patch) | |
tree | 125ee16d5080008fcf459ad55d91af1dcd488ef9 /coreutils/sleep.c | |
parent | 5b966c6180c139fba6846d632fd9bc0c34a8e1bc (diff) | |
download | busybox-w32-af3f42011628585cd5c8f5c1fd4b43f2e370a23d.tar.gz busybox-w32-af3f42011628585cd5c8f5c1fd4b43f2e370a23d.tar.bz2 busybox-w32-af3f42011628585cd5c8f5c1fd4b43f2e370a23d.zip |
Convert all coreutils/* applets to "new style" applet definitions
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'coreutils/sleep.c')
-rw-r--r-- | coreutils/sleep.c | 44 |
1 files changed, 36 insertions, 8 deletions
diff --git a/coreutils/sleep.c b/coreutils/sleep.c index 0ffbd16eb..ad2d6b526 100644 --- a/coreutils/sleep.c +++ b/coreutils/sleep.c | |||
@@ -6,17 +6,48 @@ | |||
6 | * | 6 | * |
7 | * Licensed under GPLv2 or later, see file LICENSE in this source tree. | 7 | * Licensed under GPLv2 or later, see file LICENSE in this source tree. |
8 | */ | 8 | */ |
9 | |||
10 | /* BB_AUDIT SUSv3 compliant */ | ||
11 | /* BB_AUDIT GNU issues -- fancy version matches except args must be ints. */ | ||
12 | /* http://www.opengroup.org/onlinepubs/007904975/utilities/sleep.html */ | ||
13 | |||
14 | /* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org) | 9 | /* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org) |
15 | * | 10 | * |
16 | * Rewritten to do proper arg and error checking. | 11 | * Rewritten to do proper arg and error checking. |
17 | * Also, added a 'fancy' configuration to accept multiple args with | 12 | * Also, added a 'fancy' configuration to accept multiple args with |
18 | * time suffixes for seconds, minutes, hours, and days. | 13 | * time suffixes for seconds, minutes, hours, and days. |
19 | */ | 14 | */ |
15 | //config:config SLEEP | ||
16 | //config: bool "sleep" | ||
17 | //config: default y | ||
18 | //config: help | ||
19 | //config: sleep is used to pause for a specified number of seconds. | ||
20 | //config: It comes in 3 versions: | ||
21 | //config: - small: takes one integer parameter | ||
22 | //config: - fancy: takes multiple integer arguments with suffixes: | ||
23 | //config: sleep 1d 2h 3m 15s | ||
24 | //config: - fancy with fractional numbers: | ||
25 | //config: sleep 2.3s 4.5h sleeps for 16202.3 seconds | ||
26 | //config: Last one is "the most compatible" with coreutils sleep, | ||
27 | //config: but it adds around 1k of code. | ||
28 | //config: | ||
29 | //config:config FEATURE_FANCY_SLEEP | ||
30 | //config: bool "Enable multiple arguments and s/m/h/d suffixes" | ||
31 | //config: default y | ||
32 | //config: depends on SLEEP | ||
33 | //config: help | ||
34 | //config: Allow sleep to pause for specified minutes, hours, and days. | ||
35 | //config: | ||
36 | //config:config FEATURE_FLOAT_SLEEP | ||
37 | //config: bool "Enable fractional arguments" | ||
38 | //config: default y | ||
39 | //config: depends on FEATURE_FANCY_SLEEP | ||
40 | //config: help | ||
41 | //config: Allow for fractional numeric parameters. | ||
42 | |||
43 | /* Do not make this applet NOFORK. It breaks ^C-ing of pauses in shells */ | ||
44 | //applet:IF_SLEEP(APPLET(sleep, BB_DIR_BIN, BB_SUID_DROP)) | ||
45 | |||
46 | //kbuild:lib-$(CONFIG_SLEEP) += sleep.o | ||
47 | |||
48 | /* BB_AUDIT SUSv3 compliant */ | ||
49 | /* BB_AUDIT GNU issues -- fancy version matches except args must be ints. */ | ||
50 | /* http://www.opengroup.org/onlinepubs/007904975/utilities/sleep.html */ | ||
20 | 51 | ||
21 | //usage:#define sleep_trivial_usage | 52 | //usage:#define sleep_trivial_usage |
22 | //usage: IF_FEATURE_FANCY_SLEEP("[") "N" IF_FEATURE_FANCY_SLEEP("]...") | 53 | //usage: IF_FEATURE_FANCY_SLEEP("[") "N" IF_FEATURE_FANCY_SLEEP("]...") |
@@ -35,9 +66,6 @@ | |||
35 | 66 | ||
36 | #include "libbb.h" | 67 | #include "libbb.h" |
37 | 68 | ||
38 | /* Do not make this applet NOFORK. It breaks ^C-ing of pauses in shells */ | ||
39 | |||
40 | |||
41 | #if ENABLE_FEATURE_FANCY_SLEEP || ENABLE_FEATURE_FLOAT_SLEEP | 69 | #if ENABLE_FEATURE_FANCY_SLEEP || ENABLE_FEATURE_FLOAT_SLEEP |
42 | static const struct suffix_mult sfx[] = { | 70 | static const struct suffix_mult sfx[] = { |
43 | { "s", 1 }, | 71 | { "s", 1 }, |