summaryrefslogtreecommitdiff
path: root/networking/libiproute
diff options
context:
space:
mode:
authorGlenn L McGrath <bug1@ihug.co.nz>2002-11-28 10:56:38 +0000
committerGlenn L McGrath <bug1@ihug.co.nz>2002-11-28 10:56:38 +0000
commit9048ae59238cd4bde1e5232d9edcd7b37cf5e84b (patch)
treefe4c65ac086f37176757e8309b74aefd25c03f9c /networking/libiproute
parentdf72536f8e9c337c103727c1d1503985cced73e6 (diff)
downloadbusybox-w32-9048ae59238cd4bde1e5232d9edcd7b37cf5e84b.tar.gz
busybox-w32-9048ae59238cd4bde1e5232d9edcd7b37cf5e84b.tar.bz2
busybox-w32-9048ae59238cd4bde1e5232d9edcd7b37cf5e84b.zip
Use standard error messages
Diffstat (limited to 'networking/libiproute')
-rw-r--r--networking/libiproute/iplink.c8
-rw-r--r--networking/libiproute/iproute.c18
2 files changed, 11 insertions, 15 deletions
diff --git a/networking/libiproute/iplink.c b/networking/libiproute/iplink.c
index 90d60b44c..c9d218a11 100644
--- a/networking/libiproute/iplink.c
+++ b/networking/libiproute/iplink.c
@@ -35,7 +35,7 @@
35 35
36static int on_off(char *msg) 36static int on_off(char *msg)
37{ 37{
38 fprintf(stderr, "Error: argument of \"%s\" must be \"on\" or \"off\"\n", msg); 38 error_msg("Error: argument of \"%s\" must be \"on\" or \"off\"", msg);
39 return -1; 39 return -1;
40} 40}
41 41
@@ -204,7 +204,7 @@ static int parse_address(char *dev, int hatype, int halen, char *lla, struct ifr
204 if (alen < 0) 204 if (alen < 0)
205 return -1; 205 return -1;
206 if (alen != halen) { 206 if (alen != halen) {
207 fprintf(stderr, "Wrong address (%s) length: expected %d bytes\n", lla, halen); 207 error_msg("Wrong address (%s) length: expected %d bytes", lla, halen);
208 return -1; 208 return -1;
209 } 209 }
210 return 0; 210 return 0;
@@ -286,7 +286,7 @@ static int do_set(int argc, char **argv)
286 } 286 }
287 287
288 if (!dev) { 288 if (!dev) {
289 fprintf(stderr, "Not enough of information: \"dev\" argument is required.\n"); 289 error_msg("Not enough of information: \"dev\" argument is required.");
290 exit(-1); 290 exit(-1);
291 } 291 }
292 292
@@ -344,6 +344,6 @@ int do_iplink(int argc, char **argv)
344 } else 344 } else
345 return ipaddr_list_link(0, NULL); 345 return ipaddr_list_link(0, NULL);
346 346
347 fprintf(stderr, "Command \"%s\" is unknown, try \"ip link help\".\n", *argv); 347 error_msg("Command \"%s\" is unknown, try \"ip link help\".", *argv);
348 exit(-1); 348 exit(-1);
349} 349}
diff --git a/networking/libiproute/iproute.c b/networking/libiproute/iproute.c
index 8b6e7eebd..fcfb409f2 100644
--- a/networking/libiproute/iproute.c
+++ b/networking/libiproute/iproute.c
@@ -78,7 +78,7 @@ int print_route(struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
78 } 78 }
79 len -= NLMSG_LENGTH(sizeof(*r)); 79 len -= NLMSG_LENGTH(sizeof(*r));
80 if (len < 0) { 80 if (len < 0) {
81 fprintf(stderr, "BUG: wrong nlmsg len %d\n", len); 81 error_msg("wrong nlmsg len %d", len);
82 return -1; 82 return -1;
83 } 83 }
84 84
@@ -329,7 +329,7 @@ int iproute_modify(int cmd, unsigned flags, int argc, char **argv)
329 329
330 if (d) { 330 if (d) {
331 if ((idx = ll_name_to_index(d)) == 0) { 331 if ((idx = ll_name_to_index(d)) == 0) {
332 fprintf(stderr, "Cannot find device \"%s\"\n", d); 332 error_msg("Cannot find device \"%s\"", d);
333 return -1; 333 return -1;
334 } 334 }
335 addattr32(&req.n, sizeof(req), RTA_OIF, idx); 335 addattr32(&req.n, sizeof(req), RTA_OIF, idx);
@@ -452,7 +452,7 @@ static int iproute_list(int argc, char **argv)
452 452
453 if (id) { 453 if (id) {
454 if ((idx = ll_name_to_index(id)) == 0) { 454 if ((idx = ll_name_to_index(id)) == 0) {
455 fprintf(stderr, "Cannot find device \"%s\"\n", id); 455 error_msg("Cannot find device \"%s\"", id);
456 return -1; 456 return -1;
457 } 457 }
458 filter.iif = idx; 458 filter.iif = idx;
@@ -460,8 +460,7 @@ static int iproute_list(int argc, char **argv)
460 } 460 }
461 if (od) { 461 if (od) {
462 if ((idx = ll_name_to_index(od)) == 0) { 462 if ((idx = ll_name_to_index(od)) == 0) {
463 fprintf(stderr, "Cannot find device \"%s\"\n", od); 463 error_msg("Cannot find device \"%s\"", od);
464 return -1;
465 } 464 }
466 filter.oif = idx; 465 filter.oif = idx;
467 filter.oifmask = -1; 466 filter.oifmask = -1;
@@ -470,19 +469,16 @@ static int iproute_list(int argc, char **argv)
470 469
471 if (filter.tb != -1) { 470 if (filter.tb != -1) {
472 if (rtnl_wilddump_request(&rth, do_ipv6, RTM_GETROUTE) < 0) { 471 if (rtnl_wilddump_request(&rth, do_ipv6, RTM_GETROUTE) < 0) {
473 perror("Cannot send dump request"); 472 perror_msg_and_die("Cannot send dump request");
474 exit(1);
475 } 473 }
476 } else { 474 } else {
477 if (rtnl_rtcache_request(&rth, do_ipv6) < 0) { 475 if (rtnl_rtcache_request(&rth, do_ipv6) < 0) {
478 perror("Cannot send dump request"); 476 perror_msg_and_die("Cannot send dump request");
479 exit(1);
480 } 477 }
481 } 478 }
482 479
483 if (rtnl_dump_filter(&rth, print_route, stdout, NULL, NULL) < 0) { 480 if (rtnl_dump_filter(&rth, print_route, stdout, NULL, NULL) < 0) {
484 fprintf(stderr, "Dump terminated\n"); 481 error_msg_and_die"Dump terminated");
485 exit(1);
486 } 482 }
487 483
488 exit(0); 484 exit(0);