aboutsummaryrefslogtreecommitdiff
path: root/coreutils/sleep.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2006-10-08 12:49:22 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2006-10-08 12:49:22 +0000
commit1385899416a4396385ad421ae1f532be7103738a (patch)
treefc4d14a910593d1235318bb36abe5e9f72d2039e /coreutils/sleep.c
parent5625415085e68ac5e150f54e685417c866620d76 (diff)
downloadbusybox-w32-1385899416a4396385ad421ae1f532be7103738a.tar.gz
busybox-w32-1385899416a4396385ad421ae1f532be7103738a.tar.bz2
busybox-w32-1385899416a4396385ad421ae1f532be7103738a.zip
attempt to regularize atoi mess.
Diffstat (limited to 'coreutils/sleep.c')
-rw-r--r--coreutils/sleep.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/coreutils/sleep.c b/coreutils/sleep.c
index 3946c3433..e32e2157d 100644
--- a/coreutils/sleep.c
+++ b/coreutils/sleep.c
@@ -24,7 +24,7 @@
24#include "busybox.h" 24#include "busybox.h"
25 25
26#ifdef CONFIG_FEATURE_FANCY_SLEEP 26#ifdef CONFIG_FEATURE_FANCY_SLEEP
27static const struct suffix_mult sleep_suffixes[] = { 27static const struct suffix_mult sfx[] = {
28 { "s", 1 }, 28 { "s", 1 },
29 { "m", 60 }, 29 { "m", 60 },
30 { "h", 60*60 }, 30 { "h", 60*60 },
@@ -46,9 +46,7 @@ int sleep_main(int argc, char **argv)
46 ++argv; 46 ++argv;
47 duration = 0; 47 duration = 0;
48 do { 48 do {
49 duration += bb_xgetularg_bnd_sfx(*argv, 10, 49 duration += xatoul_range_sfx(*argv, 0, UINT_MAX-duration, sfx);
50 0, UINT_MAX-duration,
51 sleep_suffixes);
52 } while (*++argv); 50 } while (*++argv);
53 51
54#else /* CONFIG_FEATURE_FANCY_SLEEP */ 52#else /* CONFIG_FEATURE_FANCY_SLEEP */
@@ -57,11 +55,7 @@ int sleep_main(int argc, char **argv)
57 bb_show_usage(); 55 bb_show_usage();
58 } 56 }
59 57
60#if UINT_MAX == ULONG_MAX 58 duration = xatou(argv[1]);
61 duration = bb_xgetularg10(argv[1]);
62#else
63 duration = bb_xgetularg10_bnd(argv[1], 0, UINT_MAX);
64#endif
65 59
66#endif /* CONFIG_FEATURE_FANCY_SLEEP */ 60#endif /* CONFIG_FEATURE_FANCY_SLEEP */
67 61