diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2006-11-05 21:05:09 +0300 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2006-11-05 21:05:09 +0300 |
commit | 5af906e7c834301a0f237b50e1a1474ce0cf6da0 (patch) | |
tree | 8a5a2783a458269715a05dc48236cae8b1cb1ee0 /networking/libiproute/ipaddress.c | |
parent | 402151671b58b264f9c023e8e29615b3dc3c9acc (diff) |
rename: compare_string_array -> index_in_str_array
introduce index_in_substr_array and use it in
iproute2
Diffstat (limited to 'networking/libiproute/ipaddress.c')
-rw-r--r-- | networking/libiproute/ipaddress.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/networking/libiproute/ipaddress.c b/networking/libiproute/ipaddress.c index fdbe6117c..fc6cf7beb 100644 --- a/networking/libiproute/ipaddress.c +++ b/networking/libiproute/ipaddress.c @@ -441,7 +441,7 @@ int ipaddr_list_or_flush(int argc, char **argv, int flush) } while (argc > 0) { - const int option_num = compare_string_array(option, *argv); + const int option_num = index_in_str_array(option, *argv); switch (option_num) { case 0: /* to */ NEXT_ARG(); @@ -653,7 +653,7 @@ static int ipaddr_modify(int cmd, int argc, char **argv) req.ifa.ifa_family = preferred_family; while (argc > 0) { - const int option_num = compare_string_array(option, *argv); + const int option_num = index_in_str_array(option, *argv); switch (option_num) { case 0: /* peer */ case 1: /* remote */ @@ -800,25 +800,24 @@ static int ipaddr_modify(int cmd, int argc, char **argv) int do_ipaddr(int argc, char **argv) { static const char *const commands[] = { - "add", "del", "delete", "list", "show", "lst", "flush", 0 + "add", "delete", "list", "show", "lst", "flush", 0 }; int command_num = 2; if (*argv) { - command_num = compare_string_array(commands, *argv); + command_num = index_in_substr_array(commands, *argv); } switch (command_num) { case 0: /* add */ return ipaddr_modify(RTM_NEWADDR, argc-1, argv+1); - case 1: /* del */ - case 2: /* delete */ + case 1: /* delete */ return ipaddr_modify(RTM_DELADDR, argc-1, argv+1); - case 3: /* list */ - case 4: /* show */ - case 5: /* lst */ + case 2: /* list */ + case 3: /* show */ + case 4: /* lst */ return ipaddr_list_or_flush(argc-1, argv+1, 0); - case 6: /* flush */ + case 5: /* flush */ return ipaddr_list_or_flush(argc-1, argv+1, 1); } bb_error_msg_and_die("unknown command %s", *argv); |