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

Denis Vlasenko vda.linux at googlemail.com
Sat Nov 4 16:57:26 PST 2006


> >> there's a recommended rule that functions be given names so that, when
> >> used in their natural context, they make intuitive sense.  for
> >> instance,
> >> 
> >>   if (compare_string_array(...)) {
> >> 
> >> doesn't really suggest what's being returned, but
> >> 
> >>   if (string_array_contains_string(...)) {
> >> 
> >> should be immediately obvious.  or something like that.
> >
> >compare_string_array() returns index of string, not just 1/0.
> >index_in_str_array()?
> 
> Given that my copy that reads strncmp() in there still lives on locally,
> i take it that this isn't fixed yet?

Sorry, I was working on making ps vaguely resemble POSIX ps lately...
now it is good time to actually test how it works.
(I use ps in my shutdown scripts)


What is the problem here? In svn I see the following:

int compare_string_array(const char * const string_array[], const char *key)
{
        int i;

        for (i = 0; string_array[i] != 0; i++) {
                if (strcmp(string_array[i], key) == 0) {
                        return i;
                }
        }
        return -i;
}

Apart from name in need of changing to index_in_str_array(), I don't
see any problem here. Please give more details.
--
vda


More information about the busybox mailing list