libiproute: fix option parsing, so that "ip -o link" works again.
authorDenis Vlasenko <vda.linux@googlemail.com>
Sat, 31 May 2008 07:34:14 +0000 (07:34 -0000)
committerDenis Vlasenko <vda.linux@googlemail.com>
Sat, 31 May 2008 07:34:14 +0000 (07:34 -0000)
closes bug 3524

libbb/compare_string_array.c
networking/libiproute/ip_parse_common_args.c

index 151b50817eefecd6deae78e7b25638cecb23365a..ec7f94e79397dfb8938433f032859c403a8aa690 100644 (file)
@@ -23,7 +23,7 @@ int index_in_strings(const char *strings, const char *key)
 {
        int idx = 0;
 
-       while (strings[0]) {
+       while (*strings) {
                if (strcmp(strings, key) == 0) {
                        return idx;
                }
@@ -57,7 +57,7 @@ int index_in_substrings(const char *strings, const char *key)
 
        if (len) {
                int idx = 0;
-               while (strings[0]) {
+               while (*strings) {
                        if (strncmp(strings, key, len) == 0) {
                                return idx;
                        }
index 294bde5401bfc377e01345114ce7e76ddb7b5364..5e4012b81e9999a70cb89c70b9c8c13c4522bc5a 100644 (file)
@@ -54,7 +54,7 @@ char **ip_parse_common_args(char **argv)
                                break;
                        }
                }
-               arg = index_in_strings(ip_common_commands, opt);
+               arg = index_in_substrings(ip_common_commands, opt);
                if (arg < 0)
                        bb_show_usage();
                if (arg == ARG_oneline) {