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 @@
*/
#include "busybox.h"
-#include <stdio.h>
-#include <sys/types.h>
-#include <stdlib.h>
-#include <unistd.h>
#include <sys/timex.h>
static const struct {int bit; const char *name;} statlist[] = {
@@ -58,19 +54,19 @@ int adjtimex_main(int argc, char **argv)
&opt_o, &opt_f, &opt_p, &opt_t);
//if (opt & 0x1) // -q
if (opt & 0x2) { // -o
- txc.offset = atoi(opt_o);
+ txc.offset = xatoi(opt_o);
txc.modes |= ADJ_OFFSET_SINGLESHOT;
}
if (opt & 0x4) { // -f
- txc.freq = atoi(opt_f);
+ txc.freq = xatou(opt_f);
txc.modes |= ADJ_FREQUENCY;
}
if (opt & 0x8) { // -p
- txc.constant = atoi(opt_p);
+ txc.constant = xatoi(opt_p);
txc.modes |= ADJ_TIMECONST;
}
if (opt & 0x10) { // -t
- txc.tick = atoi(opt_t);
+ txc.tick = xatoi(opt_t);
txc.modes |= ADJ_TICK;
}
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 {
#define DaemonUid 0
#if ENABLE_DEBUG_CROND_OPTION
-static short DebugOpt;
+static unsigned DebugOpt;
#endif
-static short LogLevel = 8;
+static unsigned LogLevel = 8;
static const char *LogFile;
static const char *CDir = CRONTABS;
@@ -155,7 +155,7 @@ int crond_main(int ac, char **av)
#endif
);
if (opt & 1) {
- LogLevel = atoi(lopt);
+ LogLevel = xatou(lopt);
}
if (opt & 2) {
if (*Lopt != 0) {
@@ -169,7 +169,7 @@ int crond_main(int ac, char **av)
}
#if ENABLE_DEBUG_CROND_OPTION
if (opt & 64) {
- DebugOpt = atoi(dopt);
+ DebugOpt = xatou(dopt);
LogLevel = 0;
}
#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)
}
o++;
}
- bb_error_msg_and_die("%s: syntax error.", argument);
+ bb_error_msg_and_die("%s: syntax error", argument);
}
/* 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
}
if (optarg) {
*set = 1;
- *value = bb_xgetlarg(optarg, 10, min, max);
+ *value = xatol_range(optarg, min, max);
}
}
@@ -2154,8 +2154,8 @@ int hdparm_main(int argc, char **argv)
#if ENABLE_FEATURE_HDPARM_HDIO_SCAN_HWIF
if (c == 'R') {
parse_opts(NULL, &scan_hwif, &hwif_data, 0, INT_MAX);
- hwif_ctrl = bb_xgetlarg((argv[optind]) ? argv[optind] : "", 10, 0, INT_MAX);
- hwif_irq = bb_xgetlarg((argv[optind+1]) ? argv[optind+1] : "", 10, 0, INT_MAX);
+ hwif_ctrl = xatoi_u((argv[optind]) ? argv[optind] : "");
+ hwif_irq = xatoi_u((argv[optind+1]) ? argv[optind+1] : "");
/* Move past the 2 additional arguments */
argv += 2;
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)
basedev = argv[1];
type = argv[2];
- Smajor = atoi(argv[3]);
- Sminor = atoi(argv[4]);
- S = atoi(argv[5]);
- E = atoi(argv[6]);
+ Smajor = xatoi_u(argv[3]);
+ Sminor = xatoi_u(argv[4]);
+ S = xatoi_u(argv[5]);
+ E = xatoi_u(argv[6]);
nodname = argc == 8 ? basedev : buf;
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)
op.mt_op = code->value;
if (argc >= 3)
- op.mt_count = atoi(argv[2]);
+ op.mt_count = xatoi_u(argv[2]);
else
op.mt_count = 1; /* One, not zero, right? */
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)
argc -= optind;
argv += optind;
- n = bb_xgetlarg(n_arg, 10, 1, INT_MAX);
+ n = xatoul_range(n_arg, 1, INT_MAX);
string = xzalloc(n + 1);
n--;
@@ -45,7 +45,8 @@ int strings_main(int argc, char **argv)
}
do {
- if ((file = bb_wfopen(*argv, "r"))) {
+ file = bb_wfopen(*argv, "r");
+ if (file) {
PIPE:
count = 0;
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)
int watchdog_main(int argc, char **argv)
{
unsigned opts;
- unsigned long timer_duration = 30; /* Userspace timer duration, in seconds */
+ unsigned timer_duration = 30; /* Userspace timer duration, in seconds */
char *t_arg;
opts = getopt32(argc, argv, "Ft:", &t_arg);
if (opts & OPT_TIMER)
- timer_duration = bb_xgetlarg(t_arg, 10, 0, INT_MAX);
+ timer_duration = xatou(t_arg);
/* We're only interested in the watchdog device .. */
if (optind < argc - 1 || argc == 1)