diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2015-10-14 13:21:01 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2015-10-14 13:21:01 +0200 |
commit | 0f296a3a56b52842057e5a2bc653621a3a6c7bec (patch) | |
tree | c504475cbf18d845698097e6b3b9656e0040d373 | |
parent | 69934701fd1b18327b3a779cb292a728834b2d0d (diff) | |
download | busybox-w32-0f296a3a56b52842057e5a2bc653621a3a6c7bec.tar.gz busybox-w32-0f296a3a56b52842057e5a2bc653621a3a6c7bec.tar.bz2 busybox-w32-0f296a3a56b52842057e5a2bc653621a3a6c7bec.zip |
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.c | 4 | ||||
-rw-r--r-- | findutils/find.c | 2 | ||||
-rw-r--r-- | include/libbb.h | 2 | ||||
-rw-r--r-- | libbb/messages.c | 2 | ||||
-rw-r--r-- | networking/brctl.c | 8 | ||||
-rw-r--r-- | networking/libiproute/ip_parse_common_args.c | 2 | ||||
-rw-r--r-- | networking/libiproute/ipaddress.c | 6 | ||||
-rw-r--r-- | networking/libiproute/iplink.c | 27 | ||||
-rw-r--r-- | networking/libiproute/ipneigh.c | 10 | ||||
-rw-r--r-- | networking/libiproute/iproute.c | 12 | ||||
-rw-r--r-- | networking/libiproute/iprule.c | 12 | ||||
-rw-r--r-- | networking/libiproute/iptunnel.c | 6 | ||||
-rw-r--r-- | networking/libiproute/utils.c | 12 | ||||
-rw-r--r-- | networking/libiproute/utils.h | 2 | ||||
-rw-r--r-- | networking/slattach.c | 6 | ||||
-rw-r--r-- | networking/tc.c | 12 |
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) | |||
326 | *arg = '\0'; | 326 | *arg = '\0'; |
327 | n = index_in_strings(conv_words, val); | 327 | n = index_in_strings(conv_words, val); |
328 | if (n < 0) | 328 | if (n < 0) |
329 | bb_error_msg_and_die(bb_msg_invalid_arg, val, "conv"); | 329 | bb_error_msg_and_die(bb_msg_invalid_arg_to, val, "conv"); |
330 | G.flags |= (1 << n); | 330 | G.flags |= (1 << n); |
331 | if (!arg) /* no ',' left, so this was the last specifier */ | 331 | if (!arg) /* no ',' left, so this was the last specifier */ |
332 | break; | 332 | break; |
@@ -368,7 +368,7 @@ int dd_main(int argc UNUSED_PARAM, char **argv) | |||
368 | int n; | 368 | int n; |
369 | n = index_in_strings(status_words, val); | 369 | n = index_in_strings(status_words, val); |
370 | if (n < 0) | 370 | if (n < 0) |
371 | bb_error_msg_and_die(bb_msg_invalid_arg, val, "status"); | 371 | bb_error_msg_and_die(bb_msg_invalid_arg_to, val, "status"); |
372 | G.flags |= FLAG_STATUS << n; | 372 | G.flags |= FLAG_STATUS << n; |
373 | /*continue;*/ | 373 | /*continue;*/ |
374 | } | 374 | } |
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) | |||
882 | mask = S_IFSOCK; | 882 | mask = S_IFSOCK; |
883 | 883 | ||
884 | if (mask == 0 || type[1] != '\0') | 884 | if (mask == 0 || type[1] != '\0') |
885 | bb_error_msg_and_die(bb_msg_invalid_arg, type, "-type"); | 885 | bb_error_msg_and_die(bb_msg_invalid_arg_to, type, "-type"); |
886 | 886 | ||
887 | return mask; | 887 | return mask; |
888 | } | 888 | } |
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; | |||
1786 | extern const char bb_msg_perm_denied_are_you_root[] ALIGN1; | 1786 | extern const char bb_msg_perm_denied_are_you_root[] ALIGN1; |
1787 | extern const char bb_msg_you_must_be_root[] ALIGN1; | 1787 | extern const char bb_msg_you_must_be_root[] ALIGN1; |
1788 | extern const char bb_msg_requires_arg[] ALIGN1; | 1788 | extern const char bb_msg_requires_arg[] ALIGN1; |
1789 | extern const char bb_msg_invalid_arg[] ALIGN1; | 1789 | extern const char bb_msg_invalid_arg_to[] ALIGN1; |
1790 | extern const char bb_msg_standard_input[] ALIGN1; | 1790 | extern const char bb_msg_standard_input[] ALIGN1; |
1791 | extern const char bb_msg_standard_output[] ALIGN1; | 1791 | extern const char bb_msg_standard_output[] ALIGN1; |
1792 | 1792 | ||
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" | |||
29 | const char bb_msg_perm_denied_are_you_root[] ALIGN1 = "permission denied (are you root?)"; | 29 | const char bb_msg_perm_denied_are_you_root[] ALIGN1 = "permission denied (are you root?)"; |
30 | const char bb_msg_you_must_be_root[] ALIGN1 = "you must be root"; | 30 | const char bb_msg_you_must_be_root[] ALIGN1 = "you must be root"; |
31 | const char bb_msg_requires_arg[] ALIGN1 = "%s requires an argument"; | 31 | const char bb_msg_requires_arg[] ALIGN1 = "%s requires an argument"; |
32 | const char bb_msg_invalid_arg[] ALIGN1 = "invalid argument '%s' to '%s'"; | 32 | const char bb_msg_invalid_arg_to[] ALIGN1 = "invalid argument '%s' to '%s'"; |
33 | const char bb_msg_standard_input[] ALIGN1 = "standard input"; | 33 | const char bb_msg_standard_input[] ALIGN1 = "standard input"; |
34 | const char bb_msg_standard_output[] ALIGN1 = "standard output"; | 34 | const char bb_msg_standard_output[] ALIGN1 = "standard output"; |
35 | 35 | ||
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, | |||
128 | # else | 128 | # else |
129 | if (sscanf(time_str, "%lf", &secs) != 1) | 129 | if (sscanf(time_str, "%lf", &secs) != 1) |
130 | # endif | 130 | # endif |
131 | bb_error_msg_and_die(bb_msg_invalid_arg, time_str, "timespec"); | 131 | bb_error_msg_and_die(bb_msg_invalid_arg_to, time_str, "timespec"); |
132 | tv->tv_sec = secs; | 132 | tv->tv_sec = secs; |
133 | tv->tv_usec = 1000000 * (secs - tv->tv_sec); | 133 | tv->tv_usec = 1000000 * (secs - tv->tv_sec); |
134 | } | 134 | } |
@@ -205,7 +205,7 @@ int brctl_main(int argc UNUSED_PARAM, char **argv) | |||
205 | 205 | ||
206 | key = index_in_strings(keywords, *argv); | 206 | key = index_in_strings(keywords, *argv); |
207 | if (key == -1) /* no match found in keywords array, bail out. */ | 207 | if (key == -1) /* no match found in keywords array, bail out. */ |
208 | bb_error_msg_and_die(bb_msg_invalid_arg, *argv, applet_name); | 208 | bb_error_msg_and_die(bb_msg_invalid_arg_to, *argv, applet_name); |
209 | argv++; | 209 | argv++; |
210 | fd = xsocket(AF_INET, SOCK_STREAM, 0); | 210 | fd = xsocket(AF_INET, SOCK_STREAM, 0); |
211 | 211 | ||
@@ -299,7 +299,7 @@ int brctl_main(int argc UNUSED_PARAM, char **argv) | |||
299 | "1\0" "on\0" "y\0" "yes\0"; /* 4 .. 7 */ | 299 | "1\0" "on\0" "y\0" "yes\0"; /* 4 .. 7 */ |
300 | int onoff = index_in_strings(no_yes, *argv); | 300 | int onoff = index_in_strings(no_yes, *argv); |
301 | if (onoff < 0) | 301 | if (onoff < 0) |
302 | bb_error_msg_and_die(bb_msg_invalid_arg, *argv, applet_name); | 302 | bb_error_msg_and_die(bb_msg_invalid_arg_to, *argv, applet_name); |
303 | onoff = (unsigned)onoff / 4; | 303 | onoff = (unsigned)onoff / 4; |
304 | arm_ioctl(args, BRCTL_SET_BRIDGE_STP_STATE, onoff, 0); | 304 | arm_ioctl(args, BRCTL_SET_BRIDGE_STP_STATE, onoff, 0); |
305 | goto fire; | 305 | goto fire; |
@@ -332,7 +332,7 @@ int brctl_main(int argc UNUSED_PARAM, char **argv) | |||
332 | 332 | ||
333 | port = if_nametoindex(*argv++); | 333 | port = if_nametoindex(*argv++); |
334 | if (!port) | 334 | if (!port) |
335 | bb_error_msg_and_die(bb_msg_invalid_arg, *argv, "port"); | 335 | bb_error_msg_and_die(bb_msg_invalid_arg_to, *argv, "port"); |
336 | memset(ifidx, 0, sizeof ifidx); | 336 | memset(ifidx, 0, sizeof ifidx); |
337 | arm_ioctl(args, BRCTL_GET_PORT_LIST, (unsigned long)ifidx, | 337 | arm_ioctl(args, BRCTL_GET_PORT_LIST, (unsigned long)ifidx, |
338 | MAX_PORTS); | 338 | 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) | |||
67 | bb_show_usage(); | 67 | bb_show_usage(); |
68 | arg = index_in_strings(families, *argv); | 68 | arg = index_in_strings(families, *argv); |
69 | if (arg < 0) | 69 | if (arg < 0) |
70 | invarg(*argv, "protocol family"); | 70 | invarg_1_to_2(*argv, "family"); |
71 | /* now arg == 0, 1 or 2 */ | 71 | /* now arg == 0, 1 or 2 */ |
72 | } else { | 72 | } else { |
73 | arg -= ARG_IPv4; | 73 | 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) | |||
455 | G_filter.scopemask = -1; | 455 | G_filter.scopemask = -1; |
456 | if (rtnl_rtscope_a2n(&scope, *argv)) { | 456 | if (rtnl_rtscope_a2n(&scope, *argv)) { |
457 | if (strcmp(*argv, "all") != 0) { | 457 | if (strcmp(*argv, "all") != 0) { |
458 | invarg(*argv, "scope"); | 458 | invarg_1_to_2(*argv, "scope"); |
459 | } | 459 | } |
460 | scope = RT_SCOPE_NOWHERE; | 460 | scope = RT_SCOPE_NOWHERE; |
461 | G_filter.scopemask = 0; | 461 | G_filter.scopemask = 0; |
@@ -669,7 +669,7 @@ static int ipaddr_modify(int cmd, int flags, char **argv) | |||
669 | } else if (arg == 5) { /* scope */ | 669 | } else if (arg == 5) { /* scope */ |
670 | uint32_t scope = 0; | 670 | uint32_t scope = 0; |
671 | if (rtnl_rtscope_a2n(&scope, *argv)) { | 671 | if (rtnl_rtscope_a2n(&scope, *argv)) { |
672 | invarg(*argv, "scope"); | 672 | invarg_1_to_2(*argv, "scope"); |
673 | } | 673 | } |
674 | req.ifa.ifa_scope = scope; | 674 | req.ifa.ifa_scope = scope; |
675 | scoped = 1; | 675 | scoped = 1; |
@@ -751,7 +751,7 @@ int FAST_FUNC do_ipaddr(char **argv) | |||
751 | if (*argv) { | 751 | if (*argv) { |
752 | cmd = index_in_substrings(commands, *argv); | 752 | cmd = index_in_substrings(commands, *argv); |
753 | if (cmd < 0) | 753 | if (cmd < 0) |
754 | invarg(*argv, applet_name); | 754 | invarg_1_to_2(*argv, applet_name); |
755 | argv++; | 755 | argv++; |
756 | if (cmd <= 4) { | 756 | if (cmd <= 4) { |
757 | return ipaddr_modify( | 757 | 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) | |||
349 | while (*argv) { | 349 | while (*argv) { |
350 | arg = index_in_substrings(keywords, *argv); | 350 | arg = index_in_substrings(keywords, *argv); |
351 | if (arg < 0) | 351 | if (arg < 0) |
352 | invarg(*argv, "type vlan"); | 352 | invarg_1_to_2(*argv, "type vlan"); |
353 | 353 | ||
354 | NEXT_ARG(); | 354 | NEXT_ARG(); |
355 | if (arg == ARG_id) { | 355 | if (arg == ARG_id) { |
@@ -512,7 +512,7 @@ static int do_add_or_delete(char **argv, const unsigned rtm) | |||
512 | if (name_str) { | 512 | if (name_str) { |
513 | const size_t name_len = strlen(name_str) + 1; | 513 | const size_t name_len = strlen(name_str) + 1; |
514 | if (name_len < 2 || name_len > IFNAMSIZ) | 514 | if (name_len < 2 || name_len > IFNAMSIZ) |
515 | invarg(name_str, "name"); | 515 | invarg_1_to_2(name_str, "name"); |
516 | addattr_l(&req.n, sizeof(req), IFLA_IFNAME, name_str, name_len); | 516 | addattr_l(&req.n, sizeof(req), IFLA_IFNAME, name_str, name_len); |
517 | } | 517 | } |
518 | if (rtnl_talk(&rth, &req.n, 0, 0, NULL, NULL, NULL) < 0) | 518 | 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) | |||
536 | if (qlen != -1) | 536 | if (qlen != -1) |
537 | duparg("txqueuelen", *argv); | 537 | duparg("txqueuelen", *argv); |
538 | if (get_integer(&qlen, *argv, 0)) | 538 | if (get_integer(&qlen, *argv, 0)) |
539 | invarg("Invalid \"txqueuelen\" value\n", *argv); | 539 | invarg_1_to_2(*argv, "txqueuelen"); |
540 | addattr_l(&req->n, sizeof(*req), IFLA_TXQLEN, &qlen, 4); | 540 | addattr_l(&req->n, sizeof(*req), IFLA_TXQLEN, &qlen, 4); |
541 | } else if (strcmp(*argv, "mtu") == 0) { | 541 | } else if (strcmp(*argv, "mtu") == 0) { |
542 | NEXT_ARG(); | 542 | NEXT_ARG(); |
543 | if (mtu != -1) | 543 | if (mtu != -1) |
544 | duparg("mtu", *argv); | 544 | duparg("mtu", *argv); |
545 | if (get_integer(&mtu, *argv, 0)) | 545 | if (get_integer(&mtu, *argv, 0)) |
546 | invarg("Invalid \"mtu\" value\n", *argv); | 546 | invarg_1_to_2(*argv, "mtu"); |
547 | addattr_l(&req->n, sizeof(*req), IFLA_MTU, &mtu, 4); | 547 | addattr_l(&req->n, sizeof(*req), IFLA_MTU, &mtu, 4); |
548 | } else if (strcmp(*argv, "netns") == 0) { | 548 | } else if (strcmp(*argv, "netns") == 0) { |
549 | NEXT_ARG(); | 549 | NEXT_ARG(); |
@@ -554,7 +554,7 @@ static int do_add_or_delete(char **argv, const unsigned rtm) | |||
554 | else if (get_integer(&netns, *argv, 0) == 0) | 554 | else if (get_integer(&netns, *argv, 0) == 0) |
555 | addattr_l(&req->n, sizeof(*req), IFLA_NET_NS_PID, &netns, 4); | 555 | addattr_l(&req->n, sizeof(*req), IFLA_NET_NS_PID, &netns, 4); |
556 | else | 556 | else |
557 | invarg("Invalid \"netns\" value\n", *argv); | 557 | invarg_1_to_2(*argv, "netns"); |
558 | } else if (strcmp(*argv, "multicast") == 0) { | 558 | } else if (strcmp(*argv, "multicast") == 0) { |
559 | NEXT_ARG(); | 559 | NEXT_ARG(); |
560 | req->i.ifi_change |= IFF_MULTICAST; | 560 | req->i.ifi_change |= IFF_MULTICAST; |
@@ -604,7 +604,7 @@ static int do_add_or_delete(char **argv, const unsigned rtm) | |||
604 | struct rtattr *vflist; | 604 | struct rtattr *vflist; |
605 | NEXT_ARG(); | 605 | NEXT_ARG(); |
606 | if (get_integer(&vf, *argv, 0)) { | 606 | if (get_integer(&vf, *argv, 0)) { |
607 | invarg("Invalid \"vf\" value\n", *argv); | 607 | invarg_1_to_2(*argv, "vf"); |
608 | } | 608 | } |
609 | vflist = addattr_nest(&req->n, sizeof(*req), | 609 | vflist = addattr_nest(&req->n, sizeof(*req), |
610 | IFLA_VFINFO_LIST); | 610 | IFLA_VFINFO_LIST); |
@@ -617,7 +617,7 @@ static int do_add_or_delete(char **argv, const unsigned rtm) | |||
617 | NEXT_ARG(); | 617 | NEXT_ARG(); |
618 | ifindex = ll_name_to_index(*argv); | 618 | ifindex = ll_name_to_index(*argv); |
619 | if (!ifindex) | 619 | if (!ifindex) |
620 | invarg("Device does not exist\n", *argv); | 620 | invarg_1_to_2(*argv, "master"); |
621 | addattr_l(&req->n, sizeof(*req), IFLA_MASTER, | 621 | addattr_l(&req->n, sizeof(*req), IFLA_MASTER, |
622 | &ifindex, 4); | 622 | &ifindex, 4); |
623 | } else if (matches(*argv, "nomaster") == 0) { | 623 | } else if (matches(*argv, "nomaster") == 0) { |
@@ -644,28 +644,27 @@ static int do_add_or_delete(char **argv, const unsigned rtm) | |||
644 | if (*group != -1) | 644 | if (*group != -1) |
645 | duparg("group", *argv); | 645 | duparg("group", *argv); |
646 | if (rtnl_group_a2n(group, *argv)) | 646 | if (rtnl_group_a2n(group, *argv)) |
647 | invarg("Invalid \"group\" value\n", *argv); | 647 | invarg_1_to_2(*argv, "group"); |
648 | } else if (strcmp(*argv, "mode") == 0) { | 648 | } else if (strcmp(*argv, "mode") == 0) { |
649 | int mode; | 649 | int mode; |
650 | NEXT_ARG(); | 650 | NEXT_ARG(); |
651 | mode = get_link_mode(*argv); | 651 | mode = get_link_mode(*argv); |
652 | if (mode < 0) | 652 | if (mode < 0) |
653 | invarg("Invalid link mode\n", *argv); | 653 | invarg_1_to_2(*argv, "mode"); |
654 | addattr8(&req->n, sizeof(*req), IFLA_LINKMODE, mode); | 654 | addattr8(&req->n, sizeof(*req), IFLA_LINKMODE, mode); |
655 | } else if (strcmp(*argv, "state") == 0) { | 655 | } else if (strcmp(*argv, "state") == 0) { |
656 | int state; | 656 | int state; |
657 | NEXT_ARG(); | 657 | NEXT_ARG(); |
658 | state = get_operstate(*argv); | 658 | state = get_operstate(*argv); |
659 | if (state < 0) | 659 | if (state < 0) |
660 | invarg("Invalid operstate\n", *argv); | 660 | invarg_1_to_2(*argv, "state"); |
661 | |||
662 | addattr8(&req->n, sizeof(*req), IFLA_OPERSTATE, state); | 661 | addattr8(&req->n, sizeof(*req), IFLA_OPERSTATE, state); |
663 | } else if (matches(*argv, "numtxqueues") == 0) { | 662 | } else if (matches(*argv, "numtxqueues") == 0) { |
664 | NEXT_ARG(); | 663 | NEXT_ARG(); |
665 | if (numtxqueues != -1) | 664 | if (numtxqueues != -1) |
666 | duparg("numtxqueues", *argv); | 665 | duparg("numtxqueues", *argv); |
667 | if (get_integer(&numtxqueues, *argv, 0)) | 666 | if (get_integer(&numtxqueues, *argv, 0)) |
668 | invarg("Invalid \"numtxqueues\" value\n", *argv); | 667 | invarg_1_to_2(*argv, "numtxqueues"); |
669 | addattr_l(&req->n, sizeof(*req), IFLA_NUM_TX_QUEUES, | 668 | addattr_l(&req->n, sizeof(*req), IFLA_NUM_TX_QUEUES, |
670 | &numtxqueues, 4); | 669 | &numtxqueues, 4); |
671 | } else if (matches(*argv, "numrxqueues") == 0) { | 670 | } else if (matches(*argv, "numrxqueues") == 0) { |
@@ -673,7 +672,7 @@ static int do_add_or_delete(char **argv, const unsigned rtm) | |||
673 | if (numrxqueues != -1) | 672 | if (numrxqueues != -1) |
674 | duparg("numrxqueues", *argv); | 673 | duparg("numrxqueues", *argv); |
675 | if (get_integer(&numrxqueues, *argv, 0)) | 674 | if (get_integer(&numrxqueues, *argv, 0)) |
676 | invarg("Invalid \"numrxqueues\" value\n", *argv); | 675 | invarg_1_to_2(*argv, "numrxqueues"); |
677 | addattr_l(&req->n, sizeof(*req), IFLA_NUM_RX_QUEUES, | 676 | addattr_l(&req->n, sizeof(*req), IFLA_NUM_RX_QUEUES, |
678 | &numrxqueues, 4); | 677 | &numrxqueues, 4); |
679 | } | 678 | } |
@@ -687,7 +686,7 @@ int FAST_FUNC do_iplink(char **argv) | |||
687 | if (*argv) { | 686 | if (*argv) { |
688 | int key = index_in_substrings(keywords, *argv); | 687 | int key = index_in_substrings(keywords, *argv); |
689 | if (key < 0) /* invalid argument */ | 688 | if (key < 0) /* invalid argument */ |
690 | invarg(*argv, applet_name); | 689 | invarg_1_to_2(*argv, applet_name); |
691 | argv++; | 690 | argv++; |
692 | if (key <= 1) /* add/delete */ | 691 | if (key <= 1) /* add/delete */ |
693 | return do_add_or_delete(argv, key ? RTM_DELLINK : RTM_NEWLINK); | 692 | 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) | |||
75 | 75 | ||
76 | id = index_in_substrings(keywords, arg); | 76 | id = index_in_substrings(keywords, arg); |
77 | if (id < 0) | 77 | if (id < 0) |
78 | bb_error_msg_and_die(bb_msg_invalid_arg, arg, "nud state"); | 78 | bb_error_msg_and_die(bb_msg_invalid_arg_to, arg, "nud state"); |
79 | return nuds[id]; | 79 | return nuds[id]; |
80 | } | 80 | } |
81 | 81 | ||
@@ -281,9 +281,9 @@ static int FAST_FUNC ipneigh_list_or_flush(char **argv, int flush) | |||
281 | ll_init_map(&rth); | 281 | ll_init_map(&rth); |
282 | 282 | ||
283 | if (filter_dev) { | 283 | if (filter_dev) { |
284 | if ((G_filter.index = xll_name_to_index(filter_dev)) == 0) { | 284 | G_filter.index = xll_name_to_index(filter_dev); |
285 | bb_error_msg_and_die(bb_msg_invalid_arg, | 285 | if (G_filter.index == 0) { |
286 | filter_dev, "Cannot find device"); | 286 | bb_error_msg_and_die("can't find device '%s'", filter_dev); |
287 | } | 287 | } |
288 | } | 288 | } |
289 | 289 | ||
@@ -349,6 +349,6 @@ int FAST_FUNC do_ipneigh(char **argv) | |||
349 | case 1: /* flush */ | 349 | case 1: /* flush */ |
350 | return ipneigh_list_or_flush(argv + 1, 1); | 350 | return ipneigh_list_or_flush(argv + 1, 1); |
351 | } | 351 | } |
352 | invarg(*argv, applet_name); | 352 | invarg_1_to_2(*argv, applet_name); |
353 | return 1; | 353 | return 1; |
354 | } | 354 | } |
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,) | |||
403 | uint32_t prot; | 403 | uint32_t prot; |
404 | NEXT_ARG(); | 404 | NEXT_ARG(); |
405 | if (rtnl_rtprot_a2n(&prot, *argv)) | 405 | if (rtnl_rtprot_a2n(&prot, *argv)) |
406 | invarg(*argv, "protocol"); | 406 | invarg_1_to_2(*argv, "protocol"); |
407 | req.r.rtm_protocol = prot; | 407 | req.r.rtm_protocol = prot; |
408 | ok |= proto_ok; | 408 | ok |= proto_ok; |
409 | #if ENABLE_FEATURE_IP_RULE | 409 | #if ENABLE_FEATURE_IP_RULE |
@@ -411,7 +411,7 @@ IF_FEATURE_IP_RULE(ARG_table,) | |||
411 | uint32_t tid; | 411 | uint32_t tid; |
412 | NEXT_ARG(); | 412 | NEXT_ARG(); |
413 | if (rtnl_rttable_a2n(&tid, *argv)) | 413 | if (rtnl_rttable_a2n(&tid, *argv)) |
414 | invarg(*argv, "table"); | 414 | invarg_1_to_2(*argv, "table"); |
415 | req.r.rtm_table = tid; | 415 | req.r.rtm_table = tid; |
416 | #endif | 416 | #endif |
417 | } else if (arg == ARG_dev || arg == ARG_oif) { | 417 | } else if (arg == ARG_dev || arg == ARG_oif) { |
@@ -597,7 +597,7 @@ static int iproute_list_or_flush(char **argv, int flush) | |||
597 | //G_filter.protocolmask = -1; | 597 | //G_filter.protocolmask = -1; |
598 | if (rtnl_rtprot_a2n(&prot, *argv)) { | 598 | if (rtnl_rtprot_a2n(&prot, *argv)) { |
599 | if (index_in_strings(keywords, *argv) != KW_all) | 599 | if (index_in_strings(keywords, *argv) != KW_all) |
600 | invarg(*argv, "protocol"); | 600 | invarg_1_to_2(*argv, "protocol"); |
601 | prot = 0; | 601 | prot = 0; |
602 | //G_filter.protocolmask = 0; | 602 | //G_filter.protocolmask = 0; |
603 | } | 603 | } |
@@ -622,10 +622,10 @@ static int iproute_list_or_flush(char **argv, int flush) | |||
622 | #if ENABLE_FEATURE_IP_RULE | 622 | #if ENABLE_FEATURE_IP_RULE |
623 | uint32_t tid; | 623 | uint32_t tid; |
624 | if (rtnl_rttable_a2n(&tid, *argv)) | 624 | if (rtnl_rttable_a2n(&tid, *argv)) |
625 | invarg(*argv, "table"); | 625 | invarg_1_to_2(*argv, "table"); |
626 | G_filter.tb = tid; | 626 | G_filter.tb = tid; |
627 | #else | 627 | #else |
628 | invarg(*argv, "table"); | 628 | invarg_1_to_2(*argv, "table"); |
629 | #endif | 629 | #endif |
630 | } | 630 | } |
631 | } else if (arg == KW_cache) { | 631 | } else if (arg == KW_cache) { |
@@ -932,7 +932,7 @@ int FAST_FUNC do_iproute(char **argv) | |||
932 | case 11: /* flush */ | 932 | case 11: /* flush */ |
933 | return iproute_list_or_flush(argv+1, 1); | 933 | return iproute_list_or_flush(argv+1, 1); |
934 | default: | 934 | default: |
935 | invarg(*argv, applet_name); | 935 | invarg_1_to_2(*argv, applet_name); |
936 | } | 936 | } |
937 | 937 | ||
938 | return iproute_modify(cmd, flags, argv+1); | 938 | 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) | |||
214 | while (*argv) { | 214 | while (*argv) { |
215 | key = index_in_substrings(keywords, *argv) + 1; | 215 | key = index_in_substrings(keywords, *argv) + 1; |
216 | if (key == 0) /* no match found in keywords array, bail out. */ | 216 | if (key == 0) /* no match found in keywords array, bail out. */ |
217 | invarg(*argv, applet_name); | 217 | invarg_1_to_2(*argv, applet_name); |
218 | if (key == ARG_from) { | 218 | if (key == ARG_from) { |
219 | inet_prefix dst; | 219 | inet_prefix dst; |
220 | NEXT_ARG(); | 220 | NEXT_ARG(); |
@@ -239,7 +239,7 @@ static int iprule_modify(int cmd, char **argv) | |||
239 | uint32_t tos; | 239 | uint32_t tos; |
240 | NEXT_ARG(); | 240 | NEXT_ARG(); |
241 | if (rtnl_dsfield_a2n(&tos, *argv)) | 241 | if (rtnl_dsfield_a2n(&tos, *argv)) |
242 | invarg(*argv, "TOS"); | 242 | invarg_1_to_2(*argv, "TOS"); |
243 | req.r.rtm_tos = tos; | 243 | req.r.rtm_tos = tos; |
244 | } else if (key == ARG_fwmark) { | 244 | } else if (key == ARG_fwmark) { |
245 | uint32_t fwmark; | 245 | uint32_t fwmark; |
@@ -250,7 +250,7 @@ static int iprule_modify(int cmd, char **argv) | |||
250 | uint32_t realm; | 250 | uint32_t realm; |
251 | NEXT_ARG(); | 251 | NEXT_ARG(); |
252 | if (get_rt_realms(&realm, *argv)) | 252 | if (get_rt_realms(&realm, *argv)) |
253 | invarg(*argv, "realms"); | 253 | invarg_1_to_2(*argv, "realms"); |
254 | addattr32(&req.n, sizeof(req), RTA_FLOW, realm); | 254 | addattr32(&req.n, sizeof(req), RTA_FLOW, realm); |
255 | } else if (key == ARG_table || | 255 | } else if (key == ARG_table || |
256 | key == ARG_lookup | 256 | key == ARG_lookup |
@@ -258,7 +258,7 @@ static int iprule_modify(int cmd, char **argv) | |||
258 | uint32_t tid; | 258 | uint32_t tid; |
259 | NEXT_ARG(); | 259 | NEXT_ARG(); |
260 | if (rtnl_rttable_a2n(&tid, *argv)) | 260 | if (rtnl_rttable_a2n(&tid, *argv)) |
261 | invarg(*argv, "table ID"); | 261 | invarg_1_to_2(*argv, "table ID"); |
262 | req.r.rtm_table = tid; | 262 | req.r.rtm_table = tid; |
263 | table_ok = 1; | 263 | table_ok = 1; |
264 | } else if (key == ARG_dev || | 264 | } else if (key == ARG_dev || |
@@ -281,7 +281,7 @@ static int iprule_modify(int cmd, char **argv) | |||
281 | if (key == ARG_help) | 281 | if (key == ARG_help) |
282 | bb_show_usage(); | 282 | bb_show_usage(); |
283 | if (rtnl_rtntype_a2n(&type, *argv)) | 283 | if (rtnl_rtntype_a2n(&type, *argv)) |
284 | invarg(*argv, "type"); | 284 | invarg_1_to_2(*argv, "type"); |
285 | req.r.rtm_type = type; | 285 | req.r.rtm_type = type; |
286 | } | 286 | } |
287 | argv++; | 287 | argv++; |
@@ -309,7 +309,7 @@ int FAST_FUNC do_iprule(char **argv) | |||
309 | if (*argv) { | 309 | if (*argv) { |
310 | int cmd = index_in_substrings(ip_rule_commands, *argv); | 310 | int cmd = index_in_substrings(ip_rule_commands, *argv); |
311 | if (cmd < 0) | 311 | if (cmd < 0) |
312 | invarg(*argv, applet_name); | 312 | invarg_1_to_2(*argv, applet_name); |
313 | argv++; | 313 | argv++; |
314 | if (cmd < 2) | 314 | if (cmd < 2) |
315 | return iprule_modify((cmd == 0) ? RTM_NEWRULE : RTM_DELRULE, argv); | 315 | 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) | |||
294 | if (key != ARG_inherit) { | 294 | if (key != ARG_inherit) { |
295 | uval = get_unsigned(*argv, "TTL"); | 295 | uval = get_unsigned(*argv, "TTL"); |
296 | if (uval > 255) | 296 | if (uval > 255) |
297 | invarg(*argv, "TTL must be <=255"); | 297 | invarg_1_to_2(*argv, "TTL"); |
298 | p->iph.ttl = uval; | 298 | p->iph.ttl = uval; |
299 | } | 299 | } |
300 | } else if (key == ARG_tos || | 300 | } else if (key == ARG_tos || |
@@ -305,7 +305,7 @@ static void parse_args(char **argv, int cmd, struct ip_tunnel_parm *p) | |||
305 | key = index_in_strings(keywords, *argv); | 305 | key = index_in_strings(keywords, *argv); |
306 | if (key != ARG_inherit) { | 306 | if (key != ARG_inherit) { |
307 | if (rtnl_dsfield_a2n(&uval, *argv)) | 307 | if (rtnl_dsfield_a2n(&uval, *argv)) |
308 | invarg(*argv, "TOS"); | 308 | invarg_1_to_2(*argv, "TOS"); |
309 | p->iph.tos = uval; | 309 | p->iph.tos = uval; |
310 | } else | 310 | } else |
311 | p->iph.tos = 1; | 311 | p->iph.tos = 1; |
@@ -562,7 +562,7 @@ int FAST_FUNC do_iptunnel(char **argv) | |||
562 | if (*argv) { | 562 | if (*argv) { |
563 | int key = index_in_substrings(keywords, *argv); | 563 | int key = index_in_substrings(keywords, *argv); |
564 | if (key < 0) | 564 | if (key < 0) |
565 | invarg(*argv, applet_name); | 565 | invarg_1_to_2(*argv, applet_name); |
566 | argv++; | 566 | argv++; |
567 | if (key == ARG_add) | 567 | if (key == ARG_add) |
568 | return do_add(SIOCADDTUNNEL, argv); | 568 | 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) | |||
47 | return res; | 47 | return res; |
48 | } | 48 | } |
49 | } | 49 | } |
50 | invarg(arg, errmsg); /* does not return */ | 50 | invarg_1_to_2(arg, errmsg); /* does not return */ |
51 | } | 51 | } |
52 | 52 | ||
53 | uint32_t get_u32(char *arg, const char *errmsg) | 53 | uint32_t get_u32(char *arg, const char *errmsg) |
@@ -62,7 +62,7 @@ uint32_t get_u32(char *arg, const char *errmsg) | |||
62 | return res; | 62 | return res; |
63 | } | 63 | } |
64 | } | 64 | } |
65 | invarg(arg, errmsg); /* does not return */ | 65 | invarg_1_to_2(arg, errmsg); /* does not return */ |
66 | } | 66 | } |
67 | 67 | ||
68 | uint16_t get_u16(char *arg, const char *errmsg) | 68 | uint16_t get_u16(char *arg, const char *errmsg) |
@@ -77,7 +77,7 @@ uint16_t get_u16(char *arg, const char *errmsg) | |||
77 | return res; | 77 | return res; |
78 | } | 78 | } |
79 | } | 79 | } |
80 | invarg(arg, errmsg); /* does not return */ | 80 | invarg_1_to_2(arg, errmsg); /* does not return */ |
81 | } | 81 | } |
82 | 82 | ||
83 | int get_addr_1(inet_prefix *addr, char *name, int family) | 83 | int get_addr_1(inet_prefix *addr, char *name, int family) |
@@ -230,12 +230,12 @@ uint32_t get_addr32(char *name) | |||
230 | 230 | ||
231 | void incomplete_command(void) | 231 | void incomplete_command(void) |
232 | { | 232 | { |
233 | bb_error_msg_and_die("command line is not complete, try option \"help\""); | 233 | bb_error_msg_and_die("command line is not complete, try \"help\""); |
234 | } | 234 | } |
235 | 235 | ||
236 | void invarg(const char *arg, const char *opt) | 236 | void invarg_1_to_2(const char *arg, const char *opt) |
237 | { | 237 | { |
238 | bb_error_msg_and_die(bb_msg_invalid_arg, arg, opt); | 238 | bb_error_msg_and_die(bb_msg_invalid_arg_to, arg, opt); |
239 | } | 239 | } |
240 | 240 | ||
241 | void duparg(const char *key, const char *arg) | 241 | 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 | |||
74 | rt_addr_n2a(af, addr, buf, buflen) | 74 | rt_addr_n2a(af, addr, buf, buflen) |
75 | #endif | 75 | #endif |
76 | 76 | ||
77 | void invarg(const char *, const char *) NORETURN; | 77 | void invarg_1_to_2(const char *, const char *) NORETURN; |
78 | void duparg(const char *, const char *) NORETURN; | 78 | void duparg(const char *, const char *) NORETURN; |
79 | void duparg2(const char *, const char *) NORETURN; | 79 | void duparg2(const char *, const char *) NORETURN; |
80 | int inet_addr_match(const inet_prefix *a, const inet_prefix *b, int bits); | 80 | 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 @@ | |||
27 | //usage: "\n -F Disable RTS/CTS flow control" | 27 | //usage: "\n -F Disable RTS/CTS flow control" |
28 | 28 | ||
29 | #include "libbb.h" | 29 | #include "libbb.h" |
30 | #include "libiproute/utils.h" /* invarg() */ | 30 | #include "libiproute/utils.h" /* invarg_1_to_2() */ |
31 | 31 | ||
32 | struct globals { | 32 | struct globals { |
33 | int handle; | 33 | int handle; |
@@ -175,7 +175,7 @@ int slattach_main(int argc UNUSED_PARAM, char **argv) | |||
175 | encap = index_in_strings(proto_names, proto); | 175 | encap = index_in_strings(proto_names, proto); |
176 | 176 | ||
177 | if (encap < 0) | 177 | if (encap < 0) |
178 | invarg(proto, "protocol"); | 178 | invarg_1_to_2(proto, "protocol"); |
179 | if (encap > 3) | 179 | if (encap > 3) |
180 | encap = 8; | 180 | encap = 8; |
181 | 181 | ||
@@ -183,7 +183,7 @@ int slattach_main(int argc UNUSED_PARAM, char **argv) | |||
183 | if (opt & OPT_s_baud) { | 183 | if (opt & OPT_s_baud) { |
184 | baud_code = tty_value_to_baud(xatoi(baud_str)); | 184 | baud_code = tty_value_to_baud(xatoi(baud_str)); |
185 | if (baud_code < 0) | 185 | if (baud_code < 0) |
186 | invarg(baud_str, "baud rate"); | 186 | invarg_1_to_2(baud_str, "baud rate"); |
187 | } | 187 | } |
188 | 188 | ||
189 | /* Trap signals in order to restore tty states upon exit */ | 189 | /* 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) | |||
459 | 459 | ||
460 | obj = index_in_substrings(objects, *argv++); | 460 | obj = index_in_substrings(objects, *argv++); |
461 | 461 | ||
462 | if (obj < OBJ_qdisc) | 462 | if (obj < 0) |
463 | bb_show_usage(); | 463 | bb_show_usage(); |
464 | if (!*argv) | 464 | if (!*argv) |
465 | cmd = CMD_show; /* list is the default */ | 465 | cmd = CMD_show; /* list is the default */ |
466 | else { | 466 | else { |
467 | cmd = index_in_substrings(commands, *argv); | 467 | cmd = index_in_substrings(commands, *argv); |
468 | if (cmd < 0) | 468 | if (cmd < 0) |
469 | bb_error_msg_and_die(bb_msg_invalid_arg, *argv, applet_name); | 469 | invarg_1_to_2(*argv, argv[-1]); |
470 | argv++; | 470 | argv++; |
471 | } | 471 | } |
472 | memset(&msg, 0, sizeof(msg)); | 472 | memset(&msg, 0, sizeof(msg)); |
@@ -489,7 +489,7 @@ int tc_main(int argc UNUSED_PARAM, char **argv) | |||
489 | NEXT_ARG(); | 489 | NEXT_ARG(); |
490 | /* We don't care about duparg2("qdisc handle",*argv) for now */ | 490 | /* We don't care about duparg2("qdisc handle",*argv) for now */ |
491 | if (get_qdisc_handle(&filter_qdisc, *argv)) | 491 | if (get_qdisc_handle(&filter_qdisc, *argv)) |
492 | invarg(*argv, "qdisc"); | 492 | invarg_1_to_2(*argv, "qdisc"); |
493 | } else | 493 | } else |
494 | if (obj != OBJ_qdisc | 494 | if (obj != OBJ_qdisc |
495 | && (arg == ARG_root | 495 | && (arg == ARG_root |
@@ -499,7 +499,7 @@ int tc_main(int argc UNUSED_PARAM, char **argv) | |||
499 | ) { | 499 | ) { |
500 | /* nothing */ | 500 | /* nothing */ |
501 | } else { | 501 | } else { |
502 | invarg(*argv, "command"); | 502 | invarg_1_to_2(*argv, "command"); |
503 | } | 503 | } |
504 | NEXT_ARG(); | 504 | NEXT_ARG(); |
505 | if (arg == ARG_root) { | 505 | if (arg == ARG_root) { |
@@ -513,7 +513,7 @@ int tc_main(int argc UNUSED_PARAM, char **argv) | |||
513 | if (msg.tcm_parent) | 513 | if (msg.tcm_parent) |
514 | duparg(*argv, "parent"); | 514 | duparg(*argv, "parent"); |
515 | if (get_tc_classid(&handle, *argv)) | 515 | if (get_tc_classid(&handle, *argv)) |
516 | invarg(*argv, "parent"); | 516 | invarg_1_to_2(*argv, "parent"); |
517 | msg.tcm_parent = handle; | 517 | msg.tcm_parent = handle; |
518 | if (obj == OBJ_filter) | 518 | if (obj == OBJ_filter) |
519 | filter_parent = handle; | 519 | filter_parent = handle; |
@@ -538,7 +538,7 @@ int tc_main(int argc UNUSED_PARAM, char **argv) | |||
538 | if (filter_proto) | 538 | if (filter_proto) |
539 | duparg(*argv, "protocol"); | 539 | duparg(*argv, "protocol"); |
540 | if (ll_proto_a2n(&tmp, *argv)) | 540 | if (ll_proto_a2n(&tmp, *argv)) |
541 | invarg(*argv, "protocol"); | 541 | invarg_1_to_2(*argv, "protocol"); |
542 | filter_proto = tmp; | 542 | filter_proto = tmp; |
543 | } | 543 | } |
544 | } | 544 | } |