aboutsummaryrefslogtreecommitdiff
path: root/miscutils
diff options
context:
space:
mode:
Diffstat (limited to 'miscutils')
-rw-r--r--miscutils/adjtimex.c12
-rw-r--r--miscutils/crond.c8
-rw-r--r--miscutils/dc.c2
-rw-r--r--miscutils/hdparm.c6
-rw-r--r--miscutils/makedevs.c8
-rw-r--r--miscutils/mt.c2
-rw-r--r--miscutils/strings.c5
-rw-r--r--miscutils/watchdog.c4
8 files changed, 22 insertions, 25 deletions
diff --git a/miscutils/adjtimex.c b/miscutils/adjtimex.c
index 47af1a5d2..b35538a84 100644
--- a/miscutils/adjtimex.c
+++ b/miscutils/adjtimex.c
@@ -12,10 +12,6 @@
12 */ 12 */
13 13
14#include "busybox.h" 14#include "busybox.h"
15#include <stdio.h>
16#include <sys/types.h>
17#include <stdlib.h>
18#include <unistd.h>
19#include <sys/timex.h> 15#include <sys/timex.h>
20 16
21static const struct {int bit; const char *name;} statlist[] = { 17static const struct {int bit; const char *name;} statlist[] = {
@@ -58,19 +54,19 @@ int adjtimex_main(int argc, char **argv)
58 &opt_o, &opt_f, &opt_p, &opt_t); 54 &opt_o, &opt_f, &opt_p, &opt_t);
59 //if (opt & 0x1) // -q 55 //if (opt & 0x1) // -q
60 if (opt & 0x2) { // -o 56 if (opt & 0x2) { // -o
61 txc.offset = atoi(opt_o); 57 txc.offset = xatoi(opt_o);
62 txc.modes |= ADJ_OFFSET_SINGLESHOT; 58 txc.modes |= ADJ_OFFSET_SINGLESHOT;
63 } 59 }
64 if (opt & 0x4) { // -f 60 if (opt & 0x4) { // -f
65 txc.freq = atoi(opt_f); 61 txc.freq = xatou(opt_f);
66 txc.modes |= ADJ_FREQUENCY; 62 txc.modes |= ADJ_FREQUENCY;
67 } 63 }
68 if (opt & 0x8) { // -p 64 if (opt & 0x8) { // -p
69 txc.constant = atoi(opt_p); 65 txc.constant = xatoi(opt_p);
70 txc.modes |= ADJ_TIMECONST; 66 txc.modes |= ADJ_TIMECONST;
71 } 67 }
72 if (opt & 0x10) { // -t 68 if (opt & 0x10) { // -t
73 txc.tick = atoi(opt_t); 69 txc.tick = xatoi(opt_t);
74 txc.modes |= ADJ_TICK; 70 txc.modes |= ADJ_TICK;
75 } 71 }
76 if (argc != optind) { /* no valid non-option parameters */ 72 if (argc != optind) { /* no valid non-option parameters */
diff --git a/miscutils/crond.c b/miscutils/crond.c
index db0cc2c6b..623e8c359 100644
--- a/miscutils/crond.c
+++ b/miscutils/crond.c
@@ -65,10 +65,10 @@ typedef struct CronLine {
65#define DaemonUid 0 65#define DaemonUid 0
66 66
67#if ENABLE_DEBUG_CROND_OPTION 67#if ENABLE_DEBUG_CROND_OPTION
68static short DebugOpt; 68static unsigned DebugOpt;
69#endif 69#endif
70 70
71static short LogLevel = 8; 71static unsigned LogLevel = 8;
72static const char *LogFile; 72static const char *LogFile;
73static const char *CDir = CRONTABS; 73static const char *CDir = CRONTABS;
74 74
@@ -155,7 +155,7 @@ int crond_main(int ac, char **av)
155#endif 155#endif
156 ); 156 );
157 if (opt & 1) { 157 if (opt & 1) {
158 LogLevel = atoi(lopt); 158 LogLevel = xatou(lopt);
159 } 159 }
160 if (opt & 2) { 160 if (opt & 2) {
161 if (*Lopt != 0) { 161 if (*Lopt != 0) {
@@ -169,7 +169,7 @@ int crond_main(int ac, char **av)
169 } 169 }
170#if ENABLE_DEBUG_CROND_OPTION 170#if ENABLE_DEBUG_CROND_OPTION
171 if (opt & 64) { 171 if (opt & 64) {
172 DebugOpt = atoi(dopt); 172 DebugOpt = xatou(dopt);
173 LogLevel = 0; 173 LogLevel = 0;
174 } 174 }
175#endif 175#endif
diff --git a/miscutils/dc.c b/miscutils/dc.c
index 95cf0d0ad..8e7a2494c 100644
--- a/miscutils/dc.c
+++ b/miscutils/dc.c
@@ -171,7 +171,7 @@ static void stack_machine(const char *argument)
171 } 171 }
172 o++; 172 o++;
173 } 173 }
174 bb_error_msg_and_die("%s: syntax error.", argument); 174 bb_error_msg_and_die("%s: syntax error", argument);
175} 175}
176 176
177/* return pointer to next token in buffer and set *buffer to one char 177/* return pointer to next token in buffer and set *buffer to one char
diff --git a/miscutils/hdparm.c b/miscutils/hdparm.c
index 6c46f6a92..1c9a99e13 100644
--- a/miscutils/hdparm.c
+++ b/miscutils/hdparm.c
@@ -2063,7 +2063,7 @@ static void parse_opts(unsigned long *get, unsigned long *set, unsigned long *va
2063 } 2063 }
2064 if (optarg) { 2064 if (optarg) {
2065 *set = 1; 2065 *set = 1;
2066 *value = bb_xgetlarg(optarg, 10, min, max); 2066 *value = xatol_range(optarg, min, max);
2067 } 2067 }
2068} 2068}
2069 2069
@@ -2154,8 +2154,8 @@ int hdparm_main(int argc, char **argv)
2154#if ENABLE_FEATURE_HDPARM_HDIO_SCAN_HWIF 2154#if ENABLE_FEATURE_HDPARM_HDIO_SCAN_HWIF
2155 if (c == 'R') { 2155 if (c == 'R') {
2156 parse_opts(NULL, &scan_hwif, &hwif_data, 0, INT_MAX); 2156 parse_opts(NULL, &scan_hwif, &hwif_data, 0, INT_MAX);
2157 hwif_ctrl = bb_xgetlarg((argv[optind]) ? argv[optind] : "", 10, 0, INT_MAX); 2157 hwif_ctrl = xatoi_u((argv[optind]) ? argv[optind] : "");
2158 hwif_irq = bb_xgetlarg((argv[optind+1]) ? argv[optind+1] : "", 10, 0, INT_MAX); 2158 hwif_irq = xatoi_u((argv[optind+1]) ? argv[optind+1] : "");
2159 /* Move past the 2 additional arguments */ 2159 /* Move past the 2 additional arguments */
2160 argv += 2; 2160 argv += 2;
2161 argc -= 2; 2161 argc -= 2;
diff --git a/miscutils/makedevs.c b/miscutils/makedevs.c
index 4619e4dd5..e27634add 100644
--- a/miscutils/makedevs.c
+++ b/miscutils/makedevs.c
@@ -21,10 +21,10 @@ int makedevs_main(int argc, char **argv)
21 21
22 basedev = argv[1]; 22 basedev = argv[1];
23 type = argv[2]; 23 type = argv[2];
24 Smajor = atoi(argv[3]); 24 Smajor = xatoi_u(argv[3]);
25 Sminor = atoi(argv[4]); 25 Sminor = xatoi_u(argv[4]);
26 S = atoi(argv[5]); 26 S = xatoi_u(argv[5]);
27 E = atoi(argv[6]); 27 E = xatoi_u(argv[6]);
28 nodname = argc == 8 ? basedev : buf; 28 nodname = argc == 8 ? basedev : buf;
29 29
30 mode = 0660; 30 mode = 0660;
diff --git a/miscutils/mt.c b/miscutils/mt.c
index f4a3be739..a2bb6be91 100644
--- a/miscutils/mt.c
+++ b/miscutils/mt.c
@@ -84,7 +84,7 @@ int mt_main(int argc, char **argv)
84 84
85 op.mt_op = code->value; 85 op.mt_op = code->value;
86 if (argc >= 3) 86 if (argc >= 3)
87 op.mt_count = atoi(argv[2]); 87 op.mt_count = xatoi_u(argv[2]);
88 else 88 else
89 op.mt_count = 1; /* One, not zero, right? */ 89 op.mt_count = 1; /* One, not zero, right? */
90 90
diff --git a/miscutils/strings.c b/miscutils/strings.c
index 36bcf8b17..1ff41ad9c 100644
--- a/miscutils/strings.c
+++ b/miscutils/strings.c
@@ -34,7 +34,7 @@ int strings_main(int argc, char **argv)
34 argc -= optind; 34 argc -= optind;
35 argv += optind; 35 argv += optind;
36 36
37 n = bb_xgetlarg(n_arg, 10, 1, INT_MAX); 37 n = xatoul_range(n_arg, 1, INT_MAX);
38 string = xzalloc(n + 1); 38 string = xzalloc(n + 1);
39 n--; 39 n--;
40 40
@@ -45,7 +45,8 @@ int strings_main(int argc, char **argv)
45 } 45 }
46 46
47 do { 47 do {
48 if ((file = bb_wfopen(*argv, "r"))) { 48 file = bb_wfopen(*argv, "r");
49 if (file) {
49PIPE: 50PIPE:
50 count = 0; 51 count = 0;
51 do { 52 do {
diff --git a/miscutils/watchdog.c b/miscutils/watchdog.c
index ae51aba7b..e342c13f3 100644
--- a/miscutils/watchdog.c
+++ b/miscutils/watchdog.c
@@ -26,13 +26,13 @@ static void watchdog_shutdown(int ATTRIBUTE_UNUSED unused)
26int watchdog_main(int argc, char **argv) 26int watchdog_main(int argc, char **argv)
27{ 27{
28 unsigned opts; 28 unsigned opts;
29 unsigned long timer_duration = 30; /* Userspace timer duration, in seconds */ 29 unsigned timer_duration = 30; /* Userspace timer duration, in seconds */
30 char *t_arg; 30 char *t_arg;
31 31
32 opts = getopt32(argc, argv, "Ft:", &t_arg); 32 opts = getopt32(argc, argv, "Ft:", &t_arg);
33 33
34 if (opts & OPT_TIMER) 34 if (opts & OPT_TIMER)
35 timer_duration = bb_xgetlarg(t_arg, 10, 0, INT_MAX); 35 timer_duration = xatou(t_arg);
36 36
37 /* We're only interested in the watchdog device .. */ 37 /* We're only interested in the watchdog device .. */
38 if (optind < argc - 1 || argc == 1) 38 if (optind < argc - 1 || argc == 1)