summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--archival/unzip.c10
-rw-r--r--coreutils/dd.c2
-rw-r--r--coreutils/diff.c9
-rw-r--r--coreutils/stty.c14
-rw-r--r--coreutils/test.c20
-rw-r--r--editors/sed.c2
-rw-r--r--findutils/find.c32
-rw-r--r--findutils/grep.c4
-rw-r--r--include/libbb.h2
-rw-r--r--libbb/messages.c8
-rw-r--r--networking/ip.c2
-rw-r--r--networking/libiproute/ip_parse_common_args.c2
-rw-r--r--networking/libiproute/ipaddress.c10
-rw-r--r--networking/libiproute/iplink.c4
-rw-r--r--networking/libiproute/iproute.c10
-rw-r--r--networking/libiproute/iptunnel.c6
-rw-r--r--networking/libiproute/utils.c4
-rw-r--r--networking/libiproute/utils.h4
-rw-r--r--networking/udhcp/dhcpc.c2
-rw-r--r--shell/ash.c2
-rw-r--r--shell/lash.c4
-rw-r--r--util-linux/fsck_minix.c10
22 files changed, 77 insertions, 86 deletions
diff --git a/archival/unzip.c b/archival/unzip.c
index c6ef9a183..8ba39e9af 100644
--- a/archival/unzip.c
+++ b/archival/unzip.c
@@ -86,7 +86,7 @@ static void unzip_skip(int fd, off_t skip)
static void unzip_read(int fd, void *buf, size_t count)
{
if (bb_xread(fd, buf, count) != count) {
- bb_error_msg_and_die("Read failure");
+ bb_error_msg_and_die(bb_msg_read_error);
}
}
@@ -95,7 +95,7 @@ static void unzip_create_leading_dirs(char *fn)
/* Create all leading directories */
char *name = bb_xstrdup(fn);
if (bb_make_directory(dirname(name), 0777, FILEUTILS_RECUR)) {
- bb_error_msg_and_die("Failed to create directory");
+ bb_error_msg_and_die("Exiting"); /* bb_make_directory is noisy */
}
free(name);
}
@@ -282,8 +282,8 @@ int unzip_main(int argc, char **argv)
unzip_skip(src_fd, zip_header.formated.extra_len);
if ((verbosity == v_list) && !list_header_done){
- printf(" Length Date Time Name\n");
- printf(" -------- ---- ---- ----\n");
+ printf(" Length Date Time Name\n"
+ " -------- ---- ---- ----\n");
list_header_done = 1;
}
@@ -321,7 +321,7 @@ int unzip_main(int argc, char **argv)
}
unzip_create_leading_dirs(dst_fn);
if (bb_make_directory(dst_fn, 0777, 0)) {
- bb_error_msg_and_die("Failed to create directory");
+ bb_error_msg_and_die("Exiting");
}
} else {
if (!S_ISDIR(stat_buf.st_mode)) {
diff --git a/coreutils/dd.c b/coreutils/dd.c
index 53aa085ed..33e789311 100644
--- a/coreutils/dd.c
+++ b/coreutils/dd.c
@@ -96,7 +96,7 @@ int dd_main(int argc, char **argv)
noerror = TRUE;
ibuf += 7;
} else {
- bb_error_msg_and_die("invalid conversion `%s'", argv[i]+5);
+ bb_error_msg_and_die(bb_msg_invalid_arg, argv[i]+5, "conv");
}
if (ibuf[0] == '\0') break;
if (ibuf[0] == ',') ibuf++;
diff --git a/coreutils/diff.c b/coreutils/diff.c
index 57b32eb78..786e2a8ab 100644
--- a/coreutils/diff.c
+++ b/coreutils/diff.c
@@ -1158,7 +1158,7 @@ static void diffdir(char *p1, char *p2)
while (*dirlist2 != NULL && strcmp(*dirlist2, start) < 0)
dirlist2++;
if ((*dirlist1 == NULL) || (*dirlist2 == NULL))
- bb_error_msg("Invalid argument to -S");
+ bb_error_msg(bb_msg_invalid_arg, "NULL", "-S");
}
/* Now that both dirlist1 and dirlist2 contain sorted directory
@@ -1194,7 +1194,6 @@ static void diffdir(char *p1, char *p2)
int diff_main(int argc, char **argv)
{
- char *ep;
int gotstdin = 0;
char *U_opt;
@@ -1229,11 +1228,7 @@ int diff_main(int argc, char **argv)
context = 3; /* This is the default number of lines of context. */
if (cmd_flags & FLAG_U) {
- context = strtol(U_opt, &ep, 10);
- if (context == 0) {
- bb_error_msg("Invalid context length");
- bb_show_usage();
- }
+ context = bb_xgetlarg(U_opt, 10, 1, INT_MAX);
}
argc -= optind;
argv += optind;
diff --git a/coreutils/stty.c b/coreutils/stty.c
index 8b70af65e..cfb7f7f39 100644
--- a/coreutils/stty.c
+++ b/coreutils/stty.c
@@ -23,6 +23,7 @@
//#define TEST
+#include "busybox.h"
#include <stddef.h>
#include <termios.h>
#include <sys/ioctl.h>
@@ -45,7 +46,6 @@
#include <errno.h>
#include <limits.h>
#include <fcntl.h>
-#include "busybox.h"
#define STREQ(a, b) (strcmp ((a), (b)) == 0)
@@ -608,7 +608,7 @@ int main(int argc, char **argv)
for (i = 0; i < NUM_control_info; ++i)
if (STREQ(argv[k], control_info[i].name)) {
if (k == argc - 1)
- bb_error_msg_and_die("missing argument to `%s'", argv[k]);
+ bb_error_msg_and_die(bb_msg_requires_arg, argv[k]);
match_found = 1;
++k;
set_control_char(&control_info[i], argv[k], &mode);
@@ -619,14 +619,14 @@ int main(int argc, char **argv)
if (match_found == 0) {
if (STREQ(argv[k], "ispeed")) {
if (k == argc - 1)
- bb_error_msg_and_die("missing argument to `%s'", argv[k]);
+ bb_error_msg_and_die(bb_msg_requires_arg, argv[k]);
++k;
set_speed(input_speed, argv[k], &mode);
speed_was_set = 1;
require_set_attr = 1;
} else if (STREQ(argv[k], "ospeed")) {
if (k == argc - 1)
- bb_error_msg_and_die("missing argument to `%s'", argv[k]);
+ bb_error_msg_and_die(bb_msg_requires_arg, argv[k]);
++k;
set_speed(output_speed, argv[k], &mode);
speed_was_set = 1;
@@ -635,13 +635,13 @@ int main(int argc, char **argv)
#ifdef TIOCGWINSZ
else if (STREQ(argv[k], "rows")) {
if (k == argc - 1)
- bb_error_msg_and_die("missing argument to `%s'", argv[k]);
+ bb_error_msg_and_die(bb_msg_requires_arg, argv[k]);
++k;
set_window_size((int) bb_xparse_number(argv[k], stty_suffixes),
-1);
} else if (STREQ(argv[k], "cols") || STREQ(argv[k], "columns")) {
if (k == argc - 1)
- bb_error_msg_and_die("missing argument to `%s'", argv[k]);
+ bb_error_msg_and_die(bb_msg_requires_arg, argv[k]);
++k;
set_window_size(-1,
(int) bb_xparse_number(argv[k], stty_suffixes));
@@ -654,7 +654,7 @@ int main(int argc, char **argv)
#ifdef HAVE_C_LINE
else if (STREQ(argv[k], "line")) {
if (k == argc - 1)
- bb_error_msg_and_die("missing argument to `%s'", argv[k]);
+ bb_error_msg_and_die(bb_msg_requires_arg, argv[k]);
++k;
mode.c_line = bb_xparse_number(argv[k], stty_suffixes);
require_set_attr = 1;
diff --git a/coreutils/test.c b/coreutils/test.c
index ecd154907..2b624e308 100644
--- a/coreutils/test.c
+++ b/coreutils/test.c
@@ -178,7 +178,6 @@ static arith_t getn(const char *s);
static int newerf(const char *f1, const char *f2);
static int olderf(const char *f1, const char *f2);
static int equalf(const char *f1, const char *f2);
-static void syntax(const char *op, const char *msg);
static int test_eaccess(char *path, int mode);
static int is_a_group_member(gid_t gid);
static void initialize_group_array(void);
@@ -230,20 +229,11 @@ int test_main(int argc, char **argv)
res = !oexpr(t_lex(*t_wp));
if (*t_wp != NULL && *++t_wp != NULL)
- syntax(*t_wp, "unknown operand");
+ bb_error_msg_and_die("%s: unknown operand", *t_wp);
return (res);
}
-static void syntax(const char *op, const char *msg)
-{
- if (op && *op) {
- bb_error_msg_and_die("%s: %s", op, msg);
- } else {
- bb_error_msg_and_die("%s", msg);
- }
-}
-
static arith_t oexpr(enum token n)
{
arith_t res;
@@ -279,18 +269,18 @@ static arith_t primary(enum token n)
arith_t res;
if (n == EOI) {
- syntax(NULL, "argument expected");
+ bb_error_msg_and_die("argument expected");
}
if (n == LPAREN) {
res = oexpr(t_lex(*++t_wp));
if (t_lex(*++t_wp) != RPAREN)
- syntax(NULL, "closing paren expected");
+ bb_error_msg_and_die("closing paren expected");
return res;
}
if (t_wp_op && t_wp_op->op_type == UNOP) {
/* unary expression */
if (*++t_wp == NULL)
- syntax(t_wp_op->op_text, "argument expected");
+ bb_error_msg_and_die(bb_msg_requires_arg, t_wp_op->op_text);
switch (n) {
case STREZ:
return strlen(*t_wp) == 0;
@@ -320,7 +310,7 @@ static int binop(void)
op = t_wp_op;
if ((opnd2 = *++t_wp) == (char *) 0)
- syntax(op->op_text, "argument expected");
+ bb_error_msg_and_die(bb_msg_requires_arg, op->op_text);
switch (op->op_num) {
case STREQ:
diff --git a/editors/sed.c b/editors/sed.c
index 71542d2ac..219a44008 100644
--- a/editors/sed.c
+++ b/editors/sed.c
@@ -1166,7 +1166,7 @@ int sed_main(int argc, char **argv)
* files were specified or '-' was specified, take input from stdin.
* Otherwise, we process all the files specified. */
if (argv[optind] == NULL) {
- if(bbg.in_place) bb_error_msg_and_die("Filename required for -i");
+ if(bbg.in_place) bb_error_msg_and_die(bb_msg_requires_arg, "-i");
add_input_file(stdin);
process_files();
} else {
diff --git a/findutils/find.c b/findutils/find.c
index f8bcccaf5..1e15e8899 100644
--- a/findutils/find.c
+++ b/findutils/find.c
@@ -20,10 +20,6 @@
#include <time.h>
#include <ctype.h>
-//XXX just found out about libbb/messages.c . maybe move stuff there ? - ghoz
-static const char msg_req_arg[] = "option `%s' requires an argument";
-static const char msg_invalid_arg[] = "invalid argument `%s' to `%s'";
-
static char *pattern;
#ifdef CONFIG_FEATURE_FIND_PRINT0
static char printsep = '\n';
@@ -188,7 +184,7 @@ static int find_type(char *type)
}
if (mask == 0 || type[1] != '\0')
- bb_error_msg_and_die(msg_invalid_arg, type, "-type");
+ bb_error_msg_and_die(bb_msg_invalid_arg, type, "-type");
return mask;
}
@@ -217,22 +213,22 @@ int find_main(int argc, char **argv)
#endif
else if (strcmp(argv[i], "-name") == 0) {
if (++i == argc)
- bb_error_msg_and_die(msg_req_arg, "-name");
+ bb_error_msg_and_die(bb_msg_requires_arg, "-name");
pattern = argv[i];
#ifdef CONFIG_FEATURE_FIND_TYPE
} else if (strcmp(argv[i], "-type") == 0) {
if (++i == argc)
- bb_error_msg_and_die(msg_req_arg, "-type");
+ bb_error_msg_and_die(bb_msg_requires_arg, "-type");
type_mask = find_type(argv[i]);
#endif
#ifdef CONFIG_FEATURE_FIND_PERM
} else if (strcmp(argv[i], "-perm") == 0) {
char *end;
if (++i == argc)
- bb_error_msg_and_die(msg_req_arg, "-perm");
+ bb_error_msg_and_die(bb_msg_requires_arg, "-perm");
perm_mask = strtol(argv[i], &end, 8);
if ((end[0] != '\0') || (perm_mask > 07777))
- bb_error_msg_and_die(msg_invalid_arg, argv[i], "-perm");
+ bb_error_msg_and_die(bb_msg_invalid_arg, argv[i], "-perm");
if ((perm_char = argv[i][0]) == '-')
perm_mask = -perm_mask;
#endif
@@ -240,10 +236,10 @@ int find_main(int argc, char **argv)
} else if (strcmp(argv[i], "-mtime") == 0) {
char *end;
if (++i == argc)
- bb_error_msg_and_die(msg_req_arg, "-mtime");
+ bb_error_msg_and_die(bb_msg_requires_arg, "-mtime");
mtime_days = strtol(argv[i], &end, 10);
if (end[0] != '\0')
- bb_error_msg_and_die(msg_invalid_arg, argv[i], "-mtime");
+ bb_error_msg_and_die(bb_msg_invalid_arg, argv[i], "-mtime");
if ((mtime_char = argv[i][0]) == '-')
mtime_days = -mtime_days;
#endif
@@ -251,10 +247,10 @@ int find_main(int argc, char **argv)
} else if (strcmp(argv[i], "-mmin") == 0) {
char *end;
if (++i == argc)
- bb_error_msg_and_die(msg_req_arg, "-mmin");
+ bb_error_msg_and_die(bb_msg_requires_arg, "-mmin");
mmin_mins = strtol(argv[i], &end, 10);
if (end[0] != '\0')
- bb_error_msg_and_die(msg_invalid_arg, argv[i], "-mmin");
+ bb_error_msg_and_die(bb_msg_invalid_arg, argv[i], "-mmin");
if ((mmin_char = argv[i][0]) == '-')
mmin_mins = -mmin_mins;
#endif
@@ -281,7 +277,7 @@ int find_main(int argc, char **argv)
} else if (strcmp(argv[i], "-newer") == 0) {
struct stat stat_newer;
if (++i == argc)
- bb_error_msg_and_die(msg_req_arg, "-newer");
+ bb_error_msg_and_die(bb_msg_requires_arg, "-newer");
xstat (argv[i], &stat_newer);
newer_mtime = stat_newer.st_mtime;
#endif
@@ -289,10 +285,10 @@ int find_main(int argc, char **argv)
} else if (strcmp(argv[i], "-inum") == 0) {
char *end;
if (++i == argc)
- bb_error_msg_and_die(msg_req_arg, "-inum");
+ bb_error_msg_and_die(bb_msg_requires_arg, "-inum");
inode_num = strtol(argv[i], &end, 10);
if (end[0] != '\0')
- bb_error_msg_and_die(msg_invalid_arg, argv[i], "-inum");
+ bb_error_msg_and_die(bb_msg_invalid_arg, argv[i], "-inum");
#endif
#ifdef CONFIG_FEATURE_FIND_EXEC
} else if (strcmp(argv[i], "-exec") == 0) {
@@ -301,14 +297,14 @@ int find_main(int argc, char **argv)
while (i++) {
if (i == argc)
- bb_error_msg_and_die(msg_req_arg, "-exec");
+ bb_error_msg_and_die(bb_msg_requires_arg, "-exec");
if (*argv[i] == ';')
break;
cmd_string = bb_xasprintf("%s %s", cmd_string, argv[i]);
}
if (*cmd_string == 0)
- bb_error_msg_and_die(msg_req_arg, "-exec");
+ bb_error_msg_and_die(bb_msg_requires_arg, "-exec");
cmd_string++;
exec_str = xmalloc(sizeof(char *));
diff --git a/findutils/grep.c b/findutils/grep.c
index a24be248b..ecb1d0457 100644
--- a/findutils/grep.c
+++ b/findutils/grep.c
@@ -313,12 +313,12 @@ int grep_main(int argc, char **argv)
if(opt & GREP_OPT_A) {
lines_after = strtoul(slines_after, &junk, 10);
if(*junk != '\0')
- bb_error_msg_and_die("invalid context length argument");
+ bb_error_msg_and_die(bb_msg_invalid_arg, slines_after, "-A");
}
if(opt & GREP_OPT_B) {
lines_before = strtoul(slines_before, &junk, 10);
if(*junk != '\0')
- bb_error_msg_and_die("invalid context length argument");
+ bb_error_msg_and_die(bb_msg_invalid_arg, slines_before, "-B");
}
/* sanity checks after parse may be invalid numbers ;-) */
if ((opt & (GREP_OPT_c|GREP_OPT_q|GREP_OPT_l|GREP_OPT_L))) {
diff --git a/include/libbb.h b/include/libbb.h
index 18ad8419f..9529b56e0 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -350,6 +350,8 @@ extern const char * const bb_msg_name_longer_than_foo;
extern const char * const bb_msg_unknown;
extern const char * const bb_msg_can_not_create_raw_socket;
extern const char * const bb_msg_perm_denied_are_you_root;
+extern const char * const bb_msg_requires_arg;
+extern const char * const bb_msg_invalid_arg;
extern const char * const bb_msg_standard_input;
extern const char * const bb_msg_standard_output;
diff --git a/libbb/messages.c b/libbb/messages.c
index 89ac94e13..f21579861 100644
--- a/libbb/messages.c
+++ b/libbb/messages.c
@@ -38,11 +38,17 @@
const char * const bb_msg_unknown = "(unknown)";
#endif
#ifdef L_can_not_create_raw_socket
- const char * const bb_msg_can_not_create_raw_socket = "can`t create raw socket";
+ const char * const bb_msg_can_not_create_raw_socket = "can't create raw socket";
#endif
#ifdef L_perm_denied_are_you_root
const char * const bb_msg_perm_denied_are_you_root = "permission denied. (are you root?)";
#endif
+#ifdef L_msg_requires_arg
+ const char * const bb_msg_requires_arg = "%s requires an argument";
+#endif
+#ifdef L_msg_invalid_arg
+ const char * const bb_msg_invalid_arg = "invalid argument `%s' to `%s'";
+#endif
#ifdef L_msg_standard_input
const char * const bb_msg_standard_input = "standard input";
#endif
diff --git a/networking/ip.c b/networking/ip.c
index 9250484aa..bba70890d 100644
--- a/networking/ip.c
+++ b/networking/ip.c
@@ -59,7 +59,7 @@ void ip_parse_common_args(int *argcp, char ***argvp)
else if (strcmp(argv[1], "link") == 0)
preferred_family = AF_PACKET;
else
- invarg(argv[1], "invalid protocol family");
+ invarg(bb_msg_invalid_arg, argv[1], "-family");
} else if (strcmp(opt, "-4") == 0) {
preferred_family = AF_INET;
} else if (strcmp(opt, "-6") == 0) {
diff --git a/networking/libiproute/ip_parse_common_args.c b/networking/libiproute/ip_parse_common_args.c
index 52e549ea2..6d4915775 100644
--- a/networking/libiproute/ip_parse_common_args.c
+++ b/networking/libiproute/ip_parse_common_args.c
@@ -56,7 +56,7 @@ void ip_parse_common_args(int *argcp, char ***argvp)
else if (strcmp(argv[1], "link") == 0)
preferred_family = AF_PACKET;
else
- invarg(argv[1], "invalid protocol family");
+ invarg(argv[1], "protocol family");
} else if (strcmp(opt, "-4") == 0) {
preferred_family = AF_INET;
} else if (strcmp(opt, "-6") == 0) {
diff --git a/networking/libiproute/ipaddress.c b/networking/libiproute/ipaddress.c
index a048cff99..ee9825ba2 100644
--- a/networking/libiproute/ipaddress.c
+++ b/networking/libiproute/ipaddress.c
@@ -430,11 +430,11 @@ int ipaddr_list_or_flush(int argc, char **argv, int flush)
if (flush) {
if (argc <= 0) {
- fprintf(stderr, "Flush requires arguments.\n");
+ bb_error_msg(bb_msg_requires_arg, "flush");
return -1;
}
if (filter.family == AF_PACKET) {
- fprintf(stderr, "Cannot flush link addresses.\n");
+ bb_error_msg("Cannot flush link addresses.");
return -1;
}
}
@@ -456,7 +456,7 @@ int ipaddr_list_or_flush(int argc, char **argv, int flush)
filter.scopemask = -1;
if (rtnl_rtscope_a2n(&scope, *argv)) {
if (strcmp(*argv, "all") != 0) {
- invarg("invalid \"scope\"\n", *argv);
+ invarg(*argv, "scope");
}
scope = RT_SCOPE_NOWHERE;
filter.scopemask = 0;
@@ -711,7 +711,7 @@ static int ipaddr_modify(int cmd, int argc, char **argv)
uint32_t scope = 0;
NEXT_ARG();
if (rtnl_rtscope_a2n(&scope, *argv)) {
- invarg(*argv, "invalid scope value");
+ invarg(*argv, "scope");
}
req.ifa.ifa_scope = scope;
scoped = 1;
@@ -744,7 +744,7 @@ static int ipaddr_modify(int cmd, int argc, char **argv)
}
if (d == NULL) {
- bb_error_msg("Not enough information: \"dev\" argument is required");
+ bb_error_msg(bb_msg_requires_arg,"\"dev\"");
return -1;
}
if (l && matches(d, l) != 0) {
diff --git a/networking/libiproute/iplink.c b/networking/libiproute/iplink.c
index 2797f0250..9e30122c3 100644
--- a/networking/libiproute/iplink.c
+++ b/networking/libiproute/iplink.c
@@ -252,7 +252,7 @@ static int do_set(int argc, char **argv)
if (mtu != -1)
duparg("mtu", *argv);
if (get_integer(&mtu, *argv, 0))
- invarg("Invalid \"mtu\" value\n", *argv);
+ invarg(*argv, "mtu");
} else if (strcmp(*argv, "multicast") == 0) {
NEXT_ARG();
mask |= IFF_MULTICAST;
@@ -286,7 +286,7 @@ static int do_set(int argc, char **argv)
}
if (!dev) {
- bb_error_msg("Not enough of information: \"dev\" argument is required.");
+ bb_error_msg(bb_msg_requires_arg, "\"dev\"");
exit(-1);
}
diff --git a/networking/libiproute/iproute.c b/networking/libiproute/iproute.c
index 6052a3023..511e89107 100644
--- a/networking/libiproute/iproute.c
+++ b/networking/libiproute/iproute.c
@@ -343,14 +343,14 @@ static int iproute_modify(int cmd, unsigned flags, int argc, char **argv)
NEXT_ARG();
}
if (get_unsigned(&mtu, *argv, 0)) {
- invarg("\"mtu\" value is invalid\n", *argv);
+ invarg(*argv, "mtu");
}
rta_addattr32(mxrta, sizeof(mxbuf), RTAX_MTU, mtu);
} else if (matches(*argv, "protocol") == 0) {
uint32_t prot;
NEXT_ARG();
if (rtnl_rtprot_a2n(&prot, *argv))
- invarg("\"protocol\" value is invalid\n", *argv);
+ invarg(*argv, "protocol");
req.r.rtm_protocol = prot;
proto_ok =1;
} else if (strcmp(*argv, "dev") == 0 ||
@@ -487,7 +487,7 @@ static int iproute_list_or_flush(int argc, char **argv, int flush)
filter.tb = RT_TABLE_MAIN;
if (flush && argc <= 0) {
- fprintf(stderr, "\"ip route flush\" requires arguments.\n");
+ bb_error_msg(bb_msg_requires_arg, "\"ip route flush\"");
return -1;
}
@@ -498,7 +498,7 @@ static int iproute_list_or_flush(int argc, char **argv, int flush)
filter.protocolmask = -1;
if (rtnl_rtprot_a2n(&prot, *argv)) {
if (strcmp(*argv, "all") != 0) {
- invarg("invalid \"protocol\"\n", *argv);
+ invarg(*argv, "protocol");
}
prot = 0;
filter.protocolmask = 0;
@@ -541,7 +541,7 @@ static int iproute_list_or_flush(int argc, char **argv, int flush)
if (matches(*argv, "cache") == 0) {
filter.tb = -1;
} else if (matches(*argv, "main") != 0) {
- invarg("invalid \"table\"", *argv);
+ invarg(*argv, "table");
}
} else if (matches(*argv, "cache") == 0) {
filter.tb = -1;
diff --git a/networking/libiproute/iptunnel.c b/networking/libiproute/iptunnel.c
index 1b1458e1e..9b96920dc 100644
--- a/networking/libiproute/iptunnel.c
+++ b/networking/libiproute/iptunnel.c
@@ -259,9 +259,9 @@ static int parse_args(int argc, char **argv, int cmd, struct ip_tunnel_parm *p)
NEXT_ARG();
if (strcmp(*argv, "inherit") != 0) {
if (get_unsigned(&uval, *argv, 0))
- invarg("invalid TTL\n", *argv);
+ invarg(*argv, "TTL");
if (uval > 255)
- invarg("TTL must be <=255\n", *argv);
+ invarg(*argv, "TTL must be <=255");
p->iph.ttl = uval;
}
} else if (strcmp(*argv, "tos") == 0 ||
@@ -270,7 +270,7 @@ static int parse_args(int argc, char **argv, int cmd, struct ip_tunnel_parm *p)
NEXT_ARG();
if (strcmp(*argv, "inherit") != 0) {
if (rtnl_dsfield_a2n(&uval, *argv))
- invarg("bad TOS value", *argv);
+ invarg(*argv, "TOS");
p->iph.tos = uval;
} else
p->iph.tos = 1;
diff --git a/networking/libiproute/utils.c b/networking/libiproute/utils.c
index 3a161ead0..2e2aa90f8 100644
--- a/networking/libiproute/utils.c
+++ b/networking/libiproute/utils.c
@@ -240,9 +240,9 @@ void incomplete_command(void)
exit(-1);
}
-void invarg(char *msg, char *arg)
+void invarg(const char const *arg, const char const *opt)
{
- bb_error_msg("argument \"%s\" is wrong: %s", arg, msg);
+ bb_error_msg(bb_msg_invalid_arg, arg, opt);
exit(-1);
}
diff --git a/networking/libiproute/utils.h b/networking/libiproute/utils.h
index 0a3a06c15..af286c8f5 100644
--- a/networking/libiproute/utils.h
+++ b/networking/libiproute/utils.h
@@ -1,13 +1,13 @@
#ifndef __UTILS_H__
#define __UTILS_H__ 1
+#include "libbb.h"
#include <asm/types.h>
#include <resolv.h>
#include "libnetlink.h"
#include "ll_map.h"
#include "rtm_map.h"
-#include "libbb.h"
extern int preferred_family;
extern int show_stats;
@@ -77,7 +77,7 @@ extern int get_s8(__s8 *val, char *arg, int base);
extern const char *format_host(int af, int len, void *addr, char *buf, int buflen);
extern const char *rt_addr_n2a(int af, int len, void *addr, char *buf, int buflen);
-void invarg(char *, char *) ATTRIBUTE_NORETURN;
+void invarg(const char const*, const char const*) ATTRIBUTE_NORETURN;
void duparg(char *, char *) ATTRIBUTE_NORETURN;
void duparg2(char *, char *) ATTRIBUTE_NORETURN;
int matches(char *arg, char *pattern);
diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c
index c36c87602..a1b6d4626 100644
--- a/networking/udhcp/dhcpc.c
+++ b/networking/udhcp/dhcpc.c
@@ -206,7 +206,7 @@ int main(int argc, char *argv[])
{"script", required_argument, 0, 's'},
{"timeout", required_argument, 0, 'T'},
{"version", no_argument, 0, 'v'},
- {"retries", required_argument, 0, 't'},
+ {"retries", required_argument, 0, 't'},
{0, 0, 0, 0}
};
diff --git a/shell/ash.c b/shell/ash.c
index 5cdd7f006..962813dbd 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -8762,7 +8762,7 @@ procargs(int argc, char **argv)
xminusc = minusc;
if (*xargv == NULL) {
if (xminusc)
- sh_error("-c requires an argument");
+ sh_error(bb_msg_requires_arg, "-c");
sflag = 1;
}
if (iflag == 2 && sflag == 1 && isatty(0) && isatty(1))
diff --git a/shell/lash.c b/shell/lash.c
index b8ec8c66b..733b80cf5 100644
--- a/shell/lash.c
+++ b/shell/lash.c
@@ -284,7 +284,7 @@ static int builtin_fg_bg(struct child_prog *child)
}
} else {
if (sscanf(child->argv[1], "%%%d", &jobnum) != 1) {
- bb_error_msg("%s: bad argument '%s'", child->argv[0], child->argv[1]);
+ bb_error_msg(bb_msg_invalid_arg, child->argv[1], child->argv[0]);
return EXIT_FAILURE;
}
for (job = child->family->job_list->head; job; job = job->next) {
@@ -465,7 +465,7 @@ static int builtin_source(struct child_prog *child)
static int builtin_unset(struct child_prog *child)
{
if (child->argv[1] == NULL) {
- printf( "unset: parameter required.\n");
+ printf(bb_msg_requires_arg, "unset");
return EXIT_FAILURE;
}
unsetenv(child->argv[1]);
diff --git a/util-linux/fsck_minix.c b/util-linux/fsck_minix.c
index db44848b8..422cae3de 100644
--- a/util-linux/fsck_minix.c
+++ b/util-linux/fsck_minix.c
@@ -456,12 +456,13 @@ static void read_block(unsigned int nr, char *addr)
return;
}
if (BLOCK_SIZE * nr != lseek(IN, BLOCK_SIZE * nr, SEEK_SET)) {
- printf("Read error: unable to seek to block in file '%s'\n",
- current_name);
+ printf("%s: unable to seek to block in file '%s'\n",
+ bb_msg_read_error, current_name);
errors_uncorrected = 1;
memset(addr, 0, BLOCK_SIZE);
} else if (BLOCK_SIZE != read(IN, addr, BLOCK_SIZE)) {
- printf("Read error: bad block in file '%s'\n", current_name);
+ printf("%s: bad block in file '%s'\n",
+ bb_msg_read_error, current_name);
errors_uncorrected = 1;
memset(addr, 0, BLOCK_SIZE);
}
@@ -483,7 +484,8 @@ static void write_block(unsigned int nr, char *addr)
if (BLOCK_SIZE * nr != lseek(IN, BLOCK_SIZE * nr, SEEK_SET))
die("seek failed in write_block");
if (BLOCK_SIZE != write(IN, addr, BLOCK_SIZE)) {
- printf("Write error: bad block in file '%s'\n", current_name);
+ printf("%s: bad block in file '%s'\n",
+ bb_msg_write_error, current_name);
errors_uncorrected = 1;
}
}