Bernhard Reutner-Fischer wrote:
+               idx = best_len = 0;
                while (*strings) {
                        if (strncmp(strings, key, len) == 0) {
+                               size_t string_len = strlen(strings);
+                               if (string_len > best_len) {
+                                       best_len = string_len;
+                                       best_idx = idx;
+                               } else if (string_len == best_len) {
+                                       return -1; /* Ambiguous match */
+                               }
                        }
+ static const char yes_no[] ALIGN1 =
+               "0\0" "off\0" "no\0"
+               "1\0" "on\0"  "yes\0";
If I read this correctly, you would match the string "o" to "off" in preference of "on", just because "off" is a longer word? I would define ambiguous as "matches more than one word", not "matches more than one word of maximum length".

Ralf
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to