Yet another major rework of the BusyBox config system, using the considerably
[oweals/busybox.git] / networking / libiproute / iplink.c
index 90d60b44cf91b3deac863583c4440a94e236768c..33f38918a8b76874accec76d0f7e883ac9138ddf 100644 (file)
 
 #include "busybox.h"
 
+static int do_link;
+
 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 +206,7 @@ static int parse_address(char *dev, int hatype, int halen, char *lla, struct ifr
        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 +288,7 @@ static int do_set(int argc, char **argv)
        }
 
        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);
        }
 
@@ -332,6 +334,13 @@ static int do_set(int argc, char **argv)
        return 0;
 }
 
+static int ipaddr_list_link(int argc, char **argv)
+{
+       preferred_family = AF_PACKET;
+       do_link = 1;
+       return ipaddr_list(argc, argv);
+}
+
 int do_iplink(int argc, char **argv)
 {
        if (argc > 0) {
@@ -344,6 +353,6 @@ int do_iplink(int argc, char **argv)
        } 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);
 }