aboutsummaryrefslogtreecommitdiff
path: root/networking
diff options
context:
space:
mode:
authoraldot <aldot@69ca8d6d-28ef-0310-b511-8ec308f3f277>2006-06-07 20:17:41 +0000
committeraldot <aldot@69ca8d6d-28ef-0310-b511-8ec308f3f277>2006-06-07 20:17:41 +0000
commitf4532f9fd377898c339aaa81cde66c14808248dd (patch)
tree6e35288c247102998a775cbc16f9ec014e00e7fd /networking
parent2ce533f0b2a79abdfb07d8879afe08f697278158 (diff)
downloadbusybox-w32-f4532f9fd377898c339aaa81cde66c14808248dd.tar.gz
busybox-w32-f4532f9fd377898c339aaa81cde66c14808248dd.tar.bz2
busybox-w32-f4532f9fd377898c339aaa81cde66c14808248dd.zip
- reuse strings and messages. Saves about 600B
git-svn-id: svn://busybox.net/trunk/busybox@15325 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'networking')
-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
9 files changed, 22 insertions, 22 deletions
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)
59 else if (strcmp(argv[1], "link") == 0) 59 else if (strcmp(argv[1], "link") == 0)
60 preferred_family = AF_PACKET; 60 preferred_family = AF_PACKET;
61 else 61 else
62 invarg(argv[1], "invalid protocol family"); 62 invarg(bb_msg_invalid_arg, argv[1], "-family");
63 } else if (strcmp(opt, "-4") == 0) { 63 } else if (strcmp(opt, "-4") == 0) {
64 preferred_family = AF_INET; 64 preferred_family = AF_INET;
65 } else if (strcmp(opt, "-6") == 0) { 65 } 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)
56 else if (strcmp(argv[1], "link") == 0) 56 else if (strcmp(argv[1], "link") == 0)
57 preferred_family = AF_PACKET; 57 preferred_family = AF_PACKET;
58 else 58 else
59 invarg(argv[1], "invalid protocol family"); 59 invarg(argv[1], "protocol family");
60 } else if (strcmp(opt, "-4") == 0) { 60 } else if (strcmp(opt, "-4") == 0) {
61 preferred_family = AF_INET; 61 preferred_family = AF_INET;
62 } else if (strcmp(opt, "-6") == 0) { 62 } 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)
430 430
431 if (flush) { 431 if (flush) {
432 if (argc <= 0) { 432 if (argc <= 0) {
433 fprintf(stderr, "Flush requires arguments.\n"); 433 bb_error_msg(bb_msg_requires_arg, "flush");
434 return -1; 434 return -1;
435 } 435 }
436 if (filter.family == AF_PACKET) { 436 if (filter.family == AF_PACKET) {
437 fprintf(stderr, "Cannot flush link addresses.\n"); 437 bb_error_msg("Cannot flush link addresses.");
438 return -1; 438 return -1;
439 } 439 }
440 } 440 }
@@ -456,7 +456,7 @@ int ipaddr_list_or_flush(int argc, char **argv, int flush)
456 filter.scopemask = -1; 456 filter.scopemask = -1;
457 if (rtnl_rtscope_a2n(&scope, *argv)) { 457 if (rtnl_rtscope_a2n(&scope, *argv)) {
458 if (strcmp(*argv, "all") != 0) { 458 if (strcmp(*argv, "all") != 0) {
459 invarg("invalid \"scope\"\n", *argv); 459 invarg(*argv, "scope");
460 } 460 }
461 scope = RT_SCOPE_NOWHERE; 461 scope = RT_SCOPE_NOWHERE;
462 filter.scopemask = 0; 462 filter.scopemask = 0;
@@ -711,7 +711,7 @@ static int ipaddr_modify(int cmd, int argc, char **argv)
711 uint32_t scope = 0; 711 uint32_t scope = 0;
712 NEXT_ARG(); 712 NEXT_ARG();
713 if (rtnl_rtscope_a2n(&scope, *argv)) { 713 if (rtnl_rtscope_a2n(&scope, *argv)) {
714 invarg(*argv, "invalid scope value"); 714 invarg(*argv, "scope");
715 } 715 }
716 req.ifa.ifa_scope = scope; 716 req.ifa.ifa_scope = scope;
717 scoped = 1; 717 scoped = 1;
@@ -744,7 +744,7 @@ static int ipaddr_modify(int cmd, int argc, char **argv)
744 } 744 }
745 745
746 if (d == NULL) { 746 if (d == NULL) {
747 bb_error_msg("Not enough information: \"dev\" argument is required"); 747 bb_error_msg(bb_msg_requires_arg,"\"dev\"");
748 return -1; 748 return -1;
749 } 749 }
750 if (l && matches(d, l) != 0) { 750 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)
252 if (mtu != -1) 252 if (mtu != -1)
253 duparg("mtu", *argv); 253 duparg("mtu", *argv);
254 if (get_integer(&mtu, *argv, 0)) 254 if (get_integer(&mtu, *argv, 0))
255 invarg("Invalid \"mtu\" value\n", *argv); 255 invarg(*argv, "mtu");
256 } else if (strcmp(*argv, "multicast") == 0) { 256 } else if (strcmp(*argv, "multicast") == 0) {
257 NEXT_ARG(); 257 NEXT_ARG();
258 mask |= IFF_MULTICAST; 258 mask |= IFF_MULTICAST;
@@ -286,7 +286,7 @@ static int do_set(int argc, char **argv)
286 } 286 }
287 287
288 if (!dev) { 288 if (!dev) {
289 bb_error_msg("Not enough of information: \"dev\" argument is required."); 289 bb_error_msg(bb_msg_requires_arg, "\"dev\"");
290 exit(-1); 290 exit(-1);
291 } 291 }
292 292
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)
343 NEXT_ARG(); 343 NEXT_ARG();
344 } 344 }
345 if (get_unsigned(&mtu, *argv, 0)) { 345 if (get_unsigned(&mtu, *argv, 0)) {
346 invarg("\"mtu\" value is invalid\n", *argv); 346 invarg(*argv, "mtu");
347 } 347 }
348 rta_addattr32(mxrta, sizeof(mxbuf), RTAX_MTU, mtu); 348 rta_addattr32(mxrta, sizeof(mxbuf), RTAX_MTU, mtu);
349 } else if (matches(*argv, "protocol") == 0) { 349 } else if (matches(*argv, "protocol") == 0) {
350 uint32_t prot; 350 uint32_t prot;
351 NEXT_ARG(); 351 NEXT_ARG();
352 if (rtnl_rtprot_a2n(&prot, *argv)) 352 if (rtnl_rtprot_a2n(&prot, *argv))
353 invarg("\"protocol\" value is invalid\n", *argv); 353 invarg(*argv, "protocol");
354 req.r.rtm_protocol = prot; 354 req.r.rtm_protocol = prot;
355 proto_ok =1; 355 proto_ok =1;
356 } else if (strcmp(*argv, "dev") == 0 || 356 } else if (strcmp(*argv, "dev") == 0 ||
@@ -487,7 +487,7 @@ static int iproute_list_or_flush(int argc, char **argv, int flush)
487 filter.tb = RT_TABLE_MAIN; 487 filter.tb = RT_TABLE_MAIN;
488 488
489 if (flush && argc <= 0) { 489 if (flush && argc <= 0) {
490 fprintf(stderr, "\"ip route flush\" requires arguments.\n"); 490 bb_error_msg(bb_msg_requires_arg, "\"ip route flush\"");
491 return -1; 491 return -1;
492 } 492 }
493 493
@@ -498,7 +498,7 @@ static int iproute_list_or_flush(int argc, char **argv, int flush)
498 filter.protocolmask = -1; 498 filter.protocolmask = -1;
499 if (rtnl_rtprot_a2n(&prot, *argv)) { 499 if (rtnl_rtprot_a2n(&prot, *argv)) {
500 if (strcmp(*argv, "all") != 0) { 500 if (strcmp(*argv, "all") != 0) {
501 invarg("invalid \"protocol\"\n", *argv); 501 invarg(*argv, "protocol");
502 } 502 }
503 prot = 0; 503 prot = 0;
504 filter.protocolmask = 0; 504 filter.protocolmask = 0;
@@ -541,7 +541,7 @@ static int iproute_list_or_flush(int argc, char **argv, int flush)
541 if (matches(*argv, "cache") == 0) { 541 if (matches(*argv, "cache") == 0) {
542 filter.tb = -1; 542 filter.tb = -1;
543 } else if (matches(*argv, "main") != 0) { 543 } else if (matches(*argv, "main") != 0) {
544 invarg("invalid \"table\"", *argv); 544 invarg(*argv, "table");
545 } 545 }
546 } else if (matches(*argv, "cache") == 0) { 546 } else if (matches(*argv, "cache") == 0) {
547 filter.tb = -1; 547 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)
259 NEXT_ARG(); 259 NEXT_ARG();
260 if (strcmp(*argv, "inherit") != 0) { 260 if (strcmp(*argv, "inherit") != 0) {
261 if (get_unsigned(&uval, *argv, 0)) 261 if (get_unsigned(&uval, *argv, 0))
262 invarg("invalid TTL\n", *argv); 262 invarg(*argv, "TTL");
263 if (uval > 255) 263 if (uval > 255)
264 invarg("TTL must be <=255\n", *argv); 264 invarg(*argv, "TTL must be <=255");
265 p->iph.ttl = uval; 265 p->iph.ttl = uval;
266 } 266 }
267 } else if (strcmp(*argv, "tos") == 0 || 267 } 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)
270 NEXT_ARG(); 270 NEXT_ARG();
271 if (strcmp(*argv, "inherit") != 0) { 271 if (strcmp(*argv, "inherit") != 0) {
272 if (rtnl_dsfield_a2n(&uval, *argv)) 272 if (rtnl_dsfield_a2n(&uval, *argv))
273 invarg("bad TOS value", *argv); 273 invarg(*argv, "TOS");
274 p->iph.tos = uval; 274 p->iph.tos = uval;
275 } else 275 } else
276 p->iph.tos = 1; 276 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)
240 exit(-1); 240 exit(-1);
241} 241}
242 242
243void invarg(char *msg, char *arg) 243void invarg(const char const *arg, const char const *opt)
244{ 244{
245 bb_error_msg("argument \"%s\" is wrong: %s", arg, msg); 245 bb_error_msg(bb_msg_invalid_arg, arg, opt);
246 exit(-1); 246 exit(-1);
247} 247}
248 248
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 @@
1#ifndef __UTILS_H__ 1#ifndef __UTILS_H__
2#define __UTILS_H__ 1 2#define __UTILS_H__ 1
3 3
4#include "libbb.h"
4#include <asm/types.h> 5#include <asm/types.h>
5#include <resolv.h> 6#include <resolv.h>
6 7
7#include "libnetlink.h" 8#include "libnetlink.h"
8#include "ll_map.h" 9#include "ll_map.h"
9#include "rtm_map.h" 10#include "rtm_map.h"
10#include "libbb.h"
11 11
12extern int preferred_family; 12extern int preferred_family;
13extern int show_stats; 13extern int show_stats;
@@ -77,7 +77,7 @@ extern int get_s8(__s8 *val, char *arg, int base);
77extern const char *format_host(int af, int len, void *addr, char *buf, int buflen); 77extern const char *format_host(int af, int len, void *addr, char *buf, int buflen);
78extern const char *rt_addr_n2a(int af, int len, void *addr, char *buf, int buflen); 78extern const char *rt_addr_n2a(int af, int len, void *addr, char *buf, int buflen);
79 79
80void invarg(char *, char *) ATTRIBUTE_NORETURN; 80void invarg(const char const*, const char const*) ATTRIBUTE_NORETURN;
81void duparg(char *, char *) ATTRIBUTE_NORETURN; 81void duparg(char *, char *) ATTRIBUTE_NORETURN;
82void duparg2(char *, char *) ATTRIBUTE_NORETURN; 82void duparg2(char *, char *) ATTRIBUTE_NORETURN;
83int matches(char *arg, char *pattern); 83int 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[])
206 {"script", required_argument, 0, 's'}, 206 {"script", required_argument, 0, 's'},
207 {"timeout", required_argument, 0, 'T'}, 207 {"timeout", required_argument, 0, 'T'},
208 {"version", no_argument, 0, 'v'}, 208 {"version", no_argument, 0, 'v'},
209 {"retries", required_argument, 0, 't'}, 209 {"retries", required_argument, 0, 't'},
210 {0, 0, 0, 0} 210 {0, 0, 0, 0}
211 }; 211 };
212 212