[BusyBox-cvs] busybox/networking/libiproute iplink.c,1.1,1.2 iproute.c,1.2,1.3

Glenn McGrath bug1 at busybox.net
Thu Nov 28 10:56:41 UTC 2002


Update of /var/cvs/busybox/networking/libiproute
In directory winder:/tmp/cvs-serv22803/networking/libiproute

Modified Files:
	iplink.c iproute.c 
Log Message:
Use standard error messages


Index: iplink.c
===================================================================
RCS file: /var/cvs/busybox/networking/libiproute/iplink.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- iplink.c	10 Nov 2002 01:33:51 -0000	1.1
+++ iplink.c	28 Nov 2002 10:56:38 -0000	1.2
@@ -35,7 +35,7 @@
 
 static int on_off(char *msg)
 {
-	fprintf(stderr, "Error: argument of \"%s\" must be \"on\" or \"off\"\n", msg);
+	error_msg("Error: argument of \"%s\" must be \"on\" or \"off\"", msg);
 	return -1;
 }
 
@@ -204,7 +204,7 @@
 	if (alen < 0)
 		return -1;
 	if (alen != halen) {
-		fprintf(stderr, "Wrong address (%s) length: expected %d bytes\n", lla, halen);
+		error_msg("Wrong address (%s) length: expected %d bytes", lla, halen);
 		return -1;
 	}
 	return 0; 
@@ -286,7 +286,7 @@
 	}
 
 	if (!dev) {
-		fprintf(stderr, "Not enough of information: \"dev\" argument is required.\n");
+		error_msg("Not enough of information: \"dev\" argument is required.");
 		exit(-1);
 	}
 
@@ -344,6 +344,6 @@
 	} else
 		return ipaddr_list_link(0, NULL);
 
-	fprintf(stderr, "Command \"%s\" is unknown, try \"ip link help\".\n", *argv);
+	error_msg("Command \"%s\" is unknown, try \"ip link help\".", *argv);
 	exit(-1);
 }

Index: iproute.c
===================================================================
RCS file: /var/cvs/busybox/networking/libiproute/iproute.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- iproute.c	15 Nov 2002 09:12:47 -0000	1.2
+++ iproute.c	28 Nov 2002 10:56:38 -0000	1.3
@@ -78,7 +78,7 @@
 	}
 	len -= NLMSG_LENGTH(sizeof(*r));
 	if (len < 0) {
-		fprintf(stderr, "BUG: wrong nlmsg len %d\n", len);
+		error_msg("wrong nlmsg len %d", len);
 		return -1;
 	}
 
@@ -329,7 +329,7 @@
 
 		if (d) {
 			if ((idx = ll_name_to_index(d)) == 0) {
-				fprintf(stderr, "Cannot find device \"%s\"\n", d);
+				error_msg("Cannot find device \"%s\"", d);
 				return -1;
 			}
 			addattr32(&req.n, sizeof(req), RTA_OIF, idx);
@@ -452,7 +452,7 @@
 
 		if (id) {
 			if ((idx = ll_name_to_index(id)) == 0) {
-				fprintf(stderr, "Cannot find device \"%s\"\n", id);
+				error_msg("Cannot find device \"%s\"", id);
 				return -1;
 			}
 			filter.iif = idx;
@@ -460,8 +460,7 @@
 		}
 		if (od) {
 			if ((idx = ll_name_to_index(od)) == 0) {
-				fprintf(stderr, "Cannot find device \"%s\"\n", od);
-				return -1;
+				error_msg("Cannot find device \"%s\"", od);
 			}
 			filter.oif = idx;
 			filter.oifmask = -1;
@@ -470,19 +469,16 @@
 
 	if (filter.tb != -1) {
 		if (rtnl_wilddump_request(&rth, do_ipv6, RTM_GETROUTE) < 0) {
-			perror("Cannot send dump request");
-			exit(1);
+			perror_msg_and_die("Cannot send dump request");
 		}
 	} else {
 		if (rtnl_rtcache_request(&rth, do_ipv6) < 0) {
-			perror("Cannot send dump request");
-			exit(1);
+			perror_msg_and_die("Cannot send dump request");
 		}
 	}
 
 	if (rtnl_dump_filter(&rth, print_route, stdout, NULL, NULL) < 0) {
-		fprintf(stderr, "Dump terminated\n");
-		exit(1);
+		error_msg_and_die"Dump terminated");
 	}
 
 	exit(0);




More information about the busybox-cvs mailing list