summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2015-10-14 13:21:01 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2015-10-14 13:21:01 +0200
commit0f296a3a56b52842057e5a2bc653621a3a6c7bec (patch)
treec504475cbf18d845698097e6b3b9656e0040d373
parent69934701fd1b18327b3a779cb292a728834b2d0d (diff)
libiproute: rename invarg(a,b) to invarg_1_to_2(a,b)
invarg(a,b) - "invalid argument", but how a and b enter the message? invarg_1_to_2(a,b) is somewhat easier to read: "invalid argument 'a' to 'b'" Audit of usage revealed a number of bad uses, with too long messages. text data bss dec hex filename 938848 932 17448 957228 e9b2c busybox_old 938788 932 17448 957168 e9af0 busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--coreutils/dd.c4
-rw-r--r--findutils/find.c2
-rw-r--r--include/libbb.h2
-rw-r--r--libbb/messages.c2
-rw-r--r--networking/brctl.c8
-rw-r--r--networking/libiproute/ip_parse_common_args.c2
-rw-r--r--networking/libiproute/ipaddress.c6
-rw-r--r--networking/libiproute/iplink.c27
-rw-r--r--networking/libiproute/ipneigh.c10
-rw-r--r--networking/libiproute/iproute.c12
-rw-r--r--networking/libiproute/iprule.c12
-rw-r--r--networking/libiproute/iptunnel.c6
-rw-r--r--networking/libiproute/utils.c12
-rw-r--r--networking/libiproute/utils.h2
-rw-r--r--networking/slattach.c6
-rw-r--r--networking/tc.c12
16 files changed, 62 insertions, 63 deletions
diff --git a/coreutils/dd.c b/coreutils/dd.c
index 53a843ca0..6a5288da1 100644
--- a/coreutils/dd.c
+++ b/coreutils/dd.c
@@ -326,7 +326,7 @@ int dd_main(int argc UNUSED_PARAM, char **argv)
*arg = '\0';
n = index_in_strings(conv_words, val);
if (n < 0)
- bb_error_msg_and_die(bb_msg_invalid_arg, val, "conv");
+ bb_error_msg_and_die(bb_msg_invalid_arg_to, val, "conv");
G.flags |= (1 << n);
if (!arg) /* no ',' left, so this was the last specifier */
break;
@@ -368,7 +368,7 @@ int dd_main(int argc UNUSED_PARAM, char **argv)
int n;
n = index_in_strings(status_words, val);
if (n < 0)
- bb_error_msg_and_die(bb_msg_invalid_arg, val, "status");
+ bb_error_msg_and_die(bb_msg_invalid_arg_to, val, "status");
G.flags |= FLAG_STATUS << n;
/*continue;*/
}
diff --git a/findutils/find.c b/findutils/find.c
index 5bd753536..a0d4853de 100644
--- a/findutils/find.c
+++ b/findutils/find.c
@@ -882,7 +882,7 @@ static int find_type(const char *type)
mask = S_IFSOCK;
if (mask == 0 || type[1] != '\0')
- bb_error_msg_and_die(bb_msg_invalid_arg, type, "-type");
+ bb_error_msg_and_die(bb_msg_invalid_arg_to, type, "-type");
return mask;
}
diff --git a/include/libbb.h b/include/libbb.h
index 5a270cdca..f04f555c0 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -1786,7 +1786,7 @@ extern const char bb_msg_can_not_create_raw_socket[] ALIGN1;
extern const char bb_msg_perm_denied_are_you_root[] ALIGN1;
extern const char bb_msg_you_must_be_root[] ALIGN1;
extern const char bb_msg_requires_arg[] ALIGN1;
-extern const char bb_msg_invalid_arg[] ALIGN1;
+extern const char bb_msg_invalid_arg_to[] ALIGN1;
extern const char bb_msg_standard_input[] ALIGN1;
extern const char bb_msg_standard_output[] ALIGN1;
diff --git a/libbb/messages.c b/libbb/messages.c
index c1b7ba252..23e440bcd 100644
--- a/libbb/messages.c
+++ b/libbb/messages.c
@@ -29,7 +29,7 @@ const char bb_msg_can_not_create_raw_socket[] ALIGN1 = "can't create raw socket"
const char bb_msg_perm_denied_are_you_root[] ALIGN1 = "permission denied (are you root?)";
const char bb_msg_you_must_be_root[] ALIGN1 = "you must be root";
const char bb_msg_requires_arg[] ALIGN1 = "%s requires an argument";
-const char bb_msg_invalid_arg[] ALIGN1 = "invalid argument '%s' to '%s'";
+const char bb_msg_invalid_arg_to[] ALIGN1 = "invalid argument '%s' to '%s'";
const char bb_msg_standard_input[] ALIGN1 = "standard input";
const char bb_msg_standard_output[] ALIGN1 = "standard output";
diff --git a/networking/brctl.c b/networking/brctl.c
index c01a86998..b7320966a 100644
--- a/networking/brctl.c
+++ b/networking/brctl.c
@@ -128,7 +128,7 @@ static ALWAYS_INLINE void bb_strtotimeval(struct timeval *tv,
# else
if (sscanf(time_str, "%lf", &secs) != 1)
# endif
- bb_error_msg_and_die(bb_msg_invalid_arg, time_str, "timespec");
+ bb_error_msg_and_die(bb_msg_invalid_arg_to, time_str, "timespec");
tv->tv_sec = secs;
tv->tv_usec = 1000000 * (secs - tv->tv_sec);
}
@@ -205,7 +205,7 @@ int brctl_main(int argc UNUSED_PARAM, char **argv)
key = index_in_strings(keywords, *argv);
if (key == -1) /* no match found in keywords array, bail out. */
- bb_error_msg_and_die(bb_msg_invalid_arg, *argv, applet_name);
+ bb_error_msg_and_die(bb_msg_invalid_arg_to, *argv, applet_name);
argv++;
fd = xsocket(AF_INET, SOCK_STREAM, 0);
@@ -299,7 +299,7 @@ int brctl_main(int argc UNUSED_PARAM, char **argv)
"1\0" "on\0" "y\0" "yes\0"; /* 4 .. 7 */
int onoff = index_in_strings(no_yes, *argv);
if (onoff < 0)
- bb_error_msg_and_die(bb_msg_invalid_arg, *argv, applet_name);
+ bb_error_msg_and_die(bb_msg_invalid_arg_to, *argv, applet_name);
onoff = (unsigned)onoff / 4;
arm_ioctl(args, BRCTL_SET_BRIDGE_STP_STATE, onoff, 0);
goto fire;
@@ -332,7 +332,7 @@ int brctl_main(int argc UNUSED_PARAM, char **argv)
port = if_nametoindex(*argv++);
if (!port)
- bb_error_msg_and_die(bb_msg_invalid_arg, *argv, "port");
+ bb_error_msg_and_die(bb_msg_invalid_arg_to, *argv, "port");
memset(ifidx, 0, sizeof ifidx);
arm_ioctl(args, BRCTL_GET_PORT_LIST, (unsigned long)ifidx,
MAX_PORTS);
diff --git a/networking/libiproute/ip_parse_common_args.c b/networking/libiproute/ip_parse_common_args.c
index 59c759b23..1a298f738 100644
--- a/networking/libiproute/ip_parse_common_args.c
+++ b/networking/libiproute/ip_parse_common_args.c
@@ -67,7 +67,7 @@ char** FAST_FUNC ip_parse_common_args(char **argv)
bb_show_usage();
arg = index_in_strings(families, *argv);
if (arg < 0)
- invarg(*argv, "protocol family");
+ invarg_1_to_2(*argv, "family");
/* now arg == 0, 1 or 2 */
} else {
arg -= ARG_IPv4;
diff --git a/networking/libiproute/ipaddress.c b/networking/libiproute/ipaddress.c
index 8845cab91..c0f27c70d 100644
--- a/networking/libiproute/ipaddress.c
+++ b/networking/libiproute/ipaddress.c
@@ -455,7 +455,7 @@ int FAST_FUNC ipaddr_list_or_flush(char **argv, int flush)
G_filter.scopemask = -1;
if (rtnl_rtscope_a2n(&scope, *argv)) {
if (strcmp(*argv, "all") != 0) {
- invarg(*argv, "scope");
+ invarg_1_to_2(*argv, "scope");
}
scope = RT_SCOPE_NOWHERE;
G_filter.scopemask = 0;
@@ -669,7 +669,7 @@ static int ipaddr_modify(int cmd, int flags, char **argv)
} else if (arg == 5) { /* scope */
uint32_t scope = 0;
if (rtnl_rtscope_a2n(&scope, *argv)) {
- invarg(*argv, "scope");
+ invarg_1_to_2(*argv, "scope");
}
req.ifa.ifa_scope = scope;
scoped = 1;
@@ -751,7 +751,7 @@ int FAST_FUNC do_ipaddr(char **argv)
if (*argv) {
cmd = index_in_substrings(commands, *argv);
if (cmd < 0)
- invarg(*argv, applet_name);
+ invarg_1_to_2(*argv, applet_name);
argv++;
if (cmd <= 4) {
return ipaddr_modify(
diff --git a/networking/libiproute/iplink.c b/networking/libiproute/iplink.c
index 5c27c2de3..ae3ef0ceb 100644
--- a/networking/libiproute/iplink.c
+++ b/networking/libiproute/iplink.c
@@ -349,7 +349,7 @@ static void vlan_parse_opt(char **argv, struct nlmsghdr *n, unsigned int size)
while (*argv) {
arg = index_in_substrings(keywords, *argv);
if (arg < 0)
- invarg(*argv, "type vlan");
+ invarg_1_to_2(*argv, "type vlan");
NEXT_ARG();
if (arg == ARG_id) {
@@ -512,7 +512,7 @@ static int do_add_or_delete(char **argv, const unsigned rtm)
if (name_str) {
const size_t name_len = strlen(name_str) + 1;
if (name_len < 2 || name_len > IFNAMSIZ)
- invarg(name_str, "name");
+ invarg_1_to_2(name_str, "name");
addattr_l(&req.n, sizeof(req), IFLA_IFNAME, name_str, name_len);
}
if (rtnl_talk(&rth, &req.n, 0, 0, NULL, NULL, NULL) < 0)
@@ -536,14 +536,14 @@ static int do_add_or_delete(char **argv, const unsigned rtm)
if (qlen != -1)
duparg("txqueuelen", *argv);
if (get_integer(&qlen, *argv, 0))
- invarg("Invalid \"txqueuelen\" value\n", *argv);
+ invarg_1_to_2(*argv, "txqueuelen");
addattr_l(&req->n, sizeof(*req), IFLA_TXQLEN, &qlen, 4);
} else if (strcmp(*argv, "mtu") == 0) {
NEXT_ARG();
if (mtu != -1)
duparg("mtu", *argv);
if (get_integer(&mtu, *argv, 0))
- invarg("Invalid \"mtu\" value\n", *argv);
+ invarg_1_to_2(*argv, "mtu");
addattr_l(&req->n, sizeof(*req), IFLA_MTU, &mtu, 4);
} else if (strcmp(*argv, "netns") == 0) {
NEXT_ARG();
@@ -554,7 +554,7 @@ static int do_add_or_delete(char **argv, const unsigned rtm)
else if (get_integer(&netns, *argv, 0) == 0)
addattr_l(&req->n, sizeof(*req), IFLA_NET_NS_PID, &netns, 4);
else
- invarg("Invalid \"netns\" value\n", *argv);
+ invarg_1_to_2(*argv, "netns");
} else if (strcmp(*argv, "multicast") == 0) {
NEXT_ARG();
req->i.ifi_change |= IFF_MULTICAST;
@@ -604,7 +604,7 @@ static int do_add_or_delete(char **argv, const unsigned rtm)
struct rtattr *vflist;
NEXT_ARG();
if (get_integer(&vf, *argv, 0)) {
- invarg("Invalid \"vf\" value\n", *argv);
+ invarg_1_to_2(*argv, "vf");
}
vflist = addattr_nest(&req->n, sizeof(*req),
IFLA_VFINFO_LIST);
@@ -617,7 +617,7 @@ static int do_add_or_delete(char **argv, const unsigned rtm)
NEXT_ARG();
ifindex = ll_name_to_index(*argv);
if (!ifindex)
- invarg("Device does not exist\n", *argv);
+ invarg_1_to_2(*argv, "master");
addattr_l(&req->n, sizeof(*req), IFLA_MASTER,
&ifindex, 4);
} else if (matches(*argv, "nomaster") == 0) {
@@ -644,28 +644,27 @@ static int do_add_or_delete(char **argv, const unsigned rtm)
if (*group != -1)
duparg("group", *argv);
if (rtnl_group_a2n(group, *argv))
- invarg("Invalid \"group\" value\n", *argv);
+ invarg_1_to_2(*argv, "group");
} else if (strcmp(*argv, "mode") == 0) {
int mode;
NEXT_ARG();
mode = get_link_mode(*argv);
if (mode < 0)
- invarg("Invalid link mode\n", *argv);
+ invarg_1_to_2(*argv, "mode");
addattr8(&req->n, sizeof(*req), IFLA_LINKMODE, mode);
} else if (strcmp(*argv, "state") == 0) {
int state;
NEXT_ARG();
state = get_operstate(*argv);
if (state < 0)
- invarg("Invalid operstate\n", *argv);
-
+ invarg_1_to_2(*argv, "state");
addattr8(&req->n, sizeof(*req), IFLA_OPERSTATE, state);
} else if (matches(*argv, "numtxqueues") == 0) {
NEXT_ARG();
if (numtxqueues != -1)
duparg("numtxqueues", *argv);
if (get_integer(&numtxqueues, *argv, 0))
- invarg("Invalid \"numtxqueues\" value\n", *argv);
+ invarg_1_to_2(*argv, "numtxqueues");
addattr_l(&req->n, sizeof(*req), IFLA_NUM_TX_QUEUES,
&numtxqueues, 4);
} else if (matches(*argv, "numrxqueues") == 0) {
@@ -673,7 +672,7 @@ static int do_add_or_delete(char **argv, const unsigned rtm)
if (numrxqueues != -1)
duparg("numrxqueues", *argv);
if (get_integer(&numrxqueues, *argv, 0))
- invarg("Invalid \"numrxqueues\" value\n", *argv);
+ invarg_1_to_2(*argv, "numrxqueues");
addattr_l(&req->n, sizeof(*req), IFLA_NUM_RX_QUEUES,
&numrxqueues, 4);
}
@@ -687,7 +686,7 @@ int FAST_FUNC do_iplink(char **argv)
if (*argv) {
int key = index_in_substrings(keywords, *argv);
if (key < 0) /* invalid argument */
- invarg(*argv, applet_name);
+ invarg_1_to_2(*argv, applet_name);
argv++;
if (key <= 1) /* add/delete */
return do_add_or_delete(argv, key ? RTM_DELLINK : RTM_NEWLINK);
diff --git a/networking/libiproute/ipneigh.c b/networking/libiproute/ipneigh.c
index 03a15d845..6588c12f1 100644
--- a/networking/libiproute/ipneigh.c
+++ b/networking/libiproute/ipneigh.c
@@ -75,7 +75,7 @@ static unsigned nud_state_a2n(char *arg)
id = index_in_substrings(keywords, arg);
if (id < 0)
- bb_error_msg_and_die(bb_msg_invalid_arg, arg, "nud state");
+ bb_error_msg_and_die(bb_msg_invalid_arg_to, arg, "nud state");
return nuds[id];
}
@@ -281,9 +281,9 @@ static int FAST_FUNC ipneigh_list_or_flush(char **argv, int flush)
ll_init_map(&rth);
if (filter_dev) {
- if ((G_filter.index = xll_name_to_index(filter_dev)) == 0) {
- bb_error_msg_and_die(bb_msg_invalid_arg,
- filter_dev, "Cannot find device");
+ G_filter.index = xll_name_to_index(filter_dev);
+ if (G_filter.index == 0) {
+ bb_error_msg_and_die("can't find device '%s'", filter_dev);
}
}
@@ -349,6 +349,6 @@ int FAST_FUNC do_ipneigh(char **argv)
case 1: /* flush */
return ipneigh_list_or_flush(argv + 1, 1);
}
- invarg(*argv, applet_name);
+ invarg_1_to_2(*argv, applet_name);
return 1;
}
diff --git a/networking/libiproute/iproute.c b/networking/libiproute/iproute.c
index f7209b126..0d2914405 100644
--- a/networking/libiproute/iproute.c
+++ b/networking/libiproute/iproute.c
@@ -403,7 +403,7 @@ IF_FEATURE_IP_RULE(ARG_table,)
uint32_t prot;
NEXT_ARG();
if (rtnl_rtprot_a2n(&prot, *argv))
- invarg(*argv, "protocol");
+ invarg_1_to_2(*argv, "protocol");
req.r.rtm_protocol = prot;
ok |= proto_ok;
#if ENABLE_FEATURE_IP_RULE
@@ -411,7 +411,7 @@ IF_FEATURE_IP_RULE(ARG_table,)
uint32_t tid;
NEXT_ARG();
if (rtnl_rttable_a2n(&tid, *argv))
- invarg(*argv, "table");
+ invarg_1_to_2(*argv, "table");
req.r.rtm_table = tid;
#endif
} else if (arg == ARG_dev || arg == ARG_oif) {
@@ -597,7 +597,7 @@ static int iproute_list_or_flush(char **argv, int flush)
//G_filter.protocolmask = -1;
if (rtnl_rtprot_a2n(&prot, *argv)) {
if (index_in_strings(keywords, *argv) != KW_all)
- invarg(*argv, "protocol");
+ invarg_1_to_2(*argv, "protocol");
prot = 0;
//G_filter.protocolmask = 0;
}
@@ -622,10 +622,10 @@ static int iproute_list_or_flush(char **argv, int flush)
#if ENABLE_FEATURE_IP_RULE
uint32_t tid;
if (rtnl_rttable_a2n(&tid, *argv))
- invarg(*argv, "table");
+ invarg_1_to_2(*argv, "table");
G_filter.tb = tid;
#else
- invarg(*argv, "table");
+ invarg_1_to_2(*argv, "table");
#endif
}
} else if (arg == KW_cache) {
@@ -932,7 +932,7 @@ int FAST_FUNC do_iproute(char **argv)
case 11: /* flush */
return iproute_list_or_flush(argv+1, 1);
default:
- invarg(*argv, applet_name);
+ invarg_1_to_2(*argv, applet_name);
}
return iproute_modify(cmd, flags, argv+1);
diff --git a/networking/libiproute/iprule.c b/networking/libiproute/iprule.c
index 774a3e220..c3b210982 100644
--- a/networking/libiproute/iprule.c
+++ b/networking/libiproute/iprule.c
@@ -214,7 +214,7 @@ static int iprule_modify(int cmd, char **argv)
while (*argv) {
key = index_in_substrings(keywords, *argv) + 1;
if (key == 0) /* no match found in keywords array, bail out. */
- invarg(*argv, applet_name);
+ invarg_1_to_2(*argv, applet_name);
if (key == ARG_from) {
inet_prefix dst;
NEXT_ARG();
@@ -239,7 +239,7 @@ static int iprule_modify(int cmd, char **argv)
uint32_t tos;
NEXT_ARG();
if (rtnl_dsfield_a2n(&tos, *argv))
- invarg(*argv, "TOS");
+ invarg_1_to_2(*argv, "TOS");
req.r.rtm_tos = tos;
} else if (key == ARG_fwmark) {
uint32_t fwmark;
@@ -250,7 +250,7 @@ static int iprule_modify(int cmd, char **argv)
uint32_t realm;
NEXT_ARG();
if (get_rt_realms(&realm, *argv))
- invarg(*argv, "realms");
+ invarg_1_to_2(*argv, "realms");
addattr32(&req.n, sizeof(req), RTA_FLOW, realm);
} else if (key == ARG_table ||
key == ARG_lookup
@@ -258,7 +258,7 @@ static int iprule_modify(int cmd, char **argv)
uint32_t tid;
NEXT_ARG();
if (rtnl_rttable_a2n(&tid, *argv))
- invarg(*argv, "table ID");
+ invarg_1_to_2(*argv, "table ID");
req.r.rtm_table = tid;
table_ok = 1;
} else if (key == ARG_dev ||
@@ -281,7 +281,7 @@ static int iprule_modify(int cmd, char **argv)
if (key == ARG_help)
bb_show_usage();
if (rtnl_rtntype_a2n(&type, *argv))
- invarg(*argv, "type");
+ invarg_1_to_2(*argv, "type");
req.r.rtm_type = type;
}
argv++;
@@ -309,7 +309,7 @@ int FAST_FUNC do_iprule(char **argv)
if (*argv) {
int cmd = index_in_substrings(ip_rule_commands, *argv);
if (cmd < 0)
- invarg(*argv, applet_name);
+ invarg_1_to_2(*argv, applet_name);
argv++;
if (cmd < 2)
return iprule_modify((cmd == 0) ? RTM_NEWRULE : RTM_DELRULE, argv);
diff --git a/networking/libiproute/iptunnel.c b/networking/libiproute/iptunnel.c
index a65d5e579..b88c3a401 100644
--- a/networking/libiproute/iptunnel.c
+++ b/networking/libiproute/iptunnel.c
@@ -294,7 +294,7 @@ static void parse_args(char **argv, int cmd, struct ip_tunnel_parm *p)
if (key != ARG_inherit) {
uval = get_unsigned(*argv, "TTL");
if (uval > 255)
- invarg(*argv, "TTL must be <=255");
+ invarg_1_to_2(*argv, "TTL");
p->iph.ttl = uval;
}
} else if (key == ARG_tos ||
@@ -305,7 +305,7 @@ static void parse_args(char **argv, int cmd, struct ip_tunnel_parm *p)
key = index_in_strings(keywords, *argv);
if (key != ARG_inherit) {
if (rtnl_dsfield_a2n(&uval, *argv))
- invarg(*argv, "TOS");
+ invarg_1_to_2(*argv, "TOS");
p->iph.tos = uval;
} else
p->iph.tos = 1;
@@ -562,7 +562,7 @@ int FAST_FUNC do_iptunnel(char **argv)
if (*argv) {
int key = index_in_substrings(keywords, *argv);
if (key < 0)
- invarg(*argv, applet_name);
+ invarg_1_to_2(*argv, applet_name);
argv++;
if (key == ARG_add)
return do_add(SIOCADDTUNNEL, argv);
diff --git a/networking/libiproute/utils.c b/networking/libiproute/utils.c
index 37b5311f0..7f7cb4203 100644
--- a/networking/libiproute/utils.c
+++ b/networking/libiproute/utils.c
@@ -47,7 +47,7 @@ unsigned get_unsigned(char *arg, const char *errmsg)
return res;
}
}
- invarg(arg, errmsg); /* does not return */
+ invarg_1_to_2(arg, errmsg); /* does not return */
}
uint32_t get_u32(char *arg, const char *errmsg)
@@ -62,7 +62,7 @@ uint32_t get_u32(char *arg, const char *errmsg)
return res;
}
}
- invarg(arg, errmsg); /* does not return */
+ invarg_1_to_2(arg, errmsg); /* does not return */
}
uint16_t get_u16(char *arg, const char *errmsg)
@@ -77,7 +77,7 @@ uint16_t get_u16(char *arg, const char *errmsg)
return res;
}
}
- invarg(arg, errmsg); /* does not return */
+ invarg_1_to_2(arg, errmsg); /* does not return */
}
int get_addr_1(inet_prefix *addr, char *name, int family)
@@ -230,12 +230,12 @@ uint32_t get_addr32(char *name)
void incomplete_command(void)
{
- bb_error_msg_and_die("command line is not complete, try option \"help\"");
+ bb_error_msg_and_die("command line is not complete, try \"help\"");
}
-void invarg(const char *arg, const char *opt)
+void invarg_1_to_2(const char *arg, const char *opt)
{
- bb_error_msg_and_die(bb_msg_invalid_arg, arg, opt);
+ bb_error_msg_and_die(bb_msg_invalid_arg_to, arg, opt);
}
void duparg(const char *key, const char *arg)
diff --git a/networking/libiproute/utils.h b/networking/libiproute/utils.h
index cd15b706b..9bbed6481 100644
--- a/networking/libiproute/utils.h
+++ b/networking/libiproute/utils.h
@@ -74,7 +74,7 @@ extern const char *format_host(int af, int len, void *addr, char *buf, int bufle
rt_addr_n2a(af, addr, buf, buflen)
#endif
-void invarg(const char *, const char *) NORETURN;
+void invarg_1_to_2(const char *, const char *) NORETURN;
void duparg(const char *, const char *) NORETURN;
void duparg2(const char *, const char *) NORETURN;
int inet_addr_match(const inet_prefix *a, const inet_prefix *b, int bits);
diff --git a/networking/slattach.c b/networking/slattach.c
index a500da6d0..14e0c1941 100644
--- a/networking/slattach.c
+++ b/networking/slattach.c
@@ -27,7 +27,7 @@
//usage: "\n -F Disable RTS/CTS flow control"
#include "libbb.h"
-#include "libiproute/utils.h" /* invarg() */
+#include "libiproute/utils.h" /* invarg_1_to_2() */
struct globals {
int handle;
@@ -175,7 +175,7 @@ int slattach_main(int argc UNUSED_PARAM, char **argv)
encap = index_in_strings(proto_names, proto);
if (encap < 0)
- invarg(proto, "protocol");
+ invarg_1_to_2(proto, "protocol");
if (encap > 3)
encap = 8;
@@ -183,7 +183,7 @@ int slattach_main(int argc UNUSED_PARAM, char **argv)
if (opt & OPT_s_baud) {
baud_code = tty_value_to_baud(xatoi(baud_str));
if (baud_code < 0)
- invarg(baud_str, "baud rate");
+ invarg_1_to_2(baud_str, "baud rate");
}
/* Trap signals in order to restore tty states upon exit */
diff --git a/networking/tc.c b/networking/tc.c
index 6d1fef993..c84c18a67 100644
--- a/networking/tc.c
+++ b/networking/tc.c
@@ -459,14 +459,14 @@ int tc_main(int argc UNUSED_PARAM, char **argv)
obj = index_in_substrings(objects, *argv++);
- if (obj < OBJ_qdisc)
+ if (obj < 0)
bb_show_usage();
if (!*argv)
cmd = CMD_show; /* list is the default */
else {
cmd = index_in_substrings(commands, *argv);
if (cmd < 0)
- bb_error_msg_and_die(bb_msg_invalid_arg, *argv, applet_name);
+ invarg_1_to_2(*argv, argv[-1]);
argv++;
}
memset(&msg, 0, sizeof(msg));
@@ -489,7 +489,7 @@ int tc_main(int argc UNUSED_PARAM, char **argv)
NEXT_ARG();
/* We don't care about duparg2("qdisc handle",*argv) for now */
if (get_qdisc_handle(&filter_qdisc, *argv))
- invarg(*argv, "qdisc");
+ invarg_1_to_2(*argv, "qdisc");
} else
if (obj != OBJ_qdisc
&& (arg == ARG_root
@@ -499,7 +499,7 @@ int tc_main(int argc UNUSED_PARAM, char **argv)
) {
/* nothing */
} else {
- invarg(*argv, "command");
+ invarg_1_to_2(*argv, "command");
}
NEXT_ARG();
if (arg == ARG_root) {
@@ -513,7 +513,7 @@ int tc_main(int argc UNUSED_PARAM, char **argv)
if (msg.tcm_parent)
duparg(*argv, "parent");
if (get_tc_classid(&handle, *argv))
- invarg(*argv, "parent");
+ invarg_1_to_2(*argv, "parent");
msg.tcm_parent = handle;
if (obj == OBJ_filter)
filter_parent = handle;
@@ -538,7 +538,7 @@ int tc_main(int argc UNUSED_PARAM, char **argv)
if (filter_proto)
duparg(*argv, "protocol");
if (ll_proto_a2n(&tmp, *argv))
- invarg(*argv, "protocol");
+ invarg_1_to_2(*argv, "protocol");
filter_proto = tmp;
}
}