[BusyBox 0001076]: "ip addr del" does not work

Denis Vlasenko vda.linux at googlemail.com
Thu Oct 26 19:34:53 UTC 2006


On Thursday 26 October 2006 15:44, Tito wrote:
> static int compare_string_array_internal(const char * const string_array[], 	const char *key, unsigned exact_match)
> {
>           int i;
>   
>           for (i = 0; string_array[i] != 0; i++) {
>   		if (strncmp(string_array[i], key,  (exact_match)  ? strlen(key) : strlen(string_array[i])) == 0)
>  			return i;
>          }
>          return -i;
> }
> 
> 
> int compare_string_array(const char * const string_array[], const char *key)
> {
>  		return compare_string_array_internal(string_array, key, 1);
> }

compare_string_array({"aaa","bbb","ccc"}, "b") returns 1 -- ??!

> int compare_substring_array(const char * const string_array[], const char *key)

Name of this one doesn't immediately say what it is doing.
I have hard time imagining a "substring array" at all...

compare_string_array() is also can have better name.
find_in_string_array()?

It's best to send code submissions in diff -urpN form.
--
vda



More information about the busybox mailing list