From 44d5dcebc6d3d896e8a5de07cb57913d961067c8 Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Sat, 1 Nov 2008 00:10:51 +0000 Subject: iplink: accept shorthands for "address" keyword here: "ip link set address 00:11:22:33:44:55" ifupdown: use "addr" instead of "address" --- networking/libiproute/iplink.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'networking/libiproute') diff --git a/networking/libiproute/iplink.c b/networking/libiproute/iplink.c index dc936bdc5..8de17bfc6 100644 --- a/networking/libiproute/iplink.c +++ b/networking/libiproute/iplink.c @@ -174,15 +174,18 @@ static int do_set(char **argv) char *newname = NULL; int htype, halen; static const char keywords[] ALIGN1 = - "up\0""down\0""name\0""mtu\0""multicast\0""arp\0""address\0""dev\0"; - enum { ARG_up = 0, ARG_down, ARG_name, ARG_mtu, ARG_multicast, ARG_arp, - ARG_addr, ARG_dev }; + "up\0""down\0""name\0""mtu\0""multicast\0" + "arp\0""address\0""dev\0"; + enum { ARG_up = 0, ARG_down, ARG_name, ARG_mtu, ARG_multicast, + ARG_arp, ARG_addr, ARG_dev }; static const char str_on_off[] ALIGN1 = "on\0""off\0"; enum { PARM_on = 0, PARM_off }; smalluint key; while (*argv) { - key = index_in_strings(keywords, *argv); + /* substring search ensures that e.g. "addr" and "address" + * are both accepted */ + key = index_in_substrings(keywords, *argv); if (key == ARG_up) { mask |= IFF_UP; flags |= IFF_UP; -- cgit v1.2.3