Alexander Kriegisch wrote:
>> # stty erase 
>> stty: invalid number 'erase' 
>> # stty eof 
>> stty: invalid number 'eof'
>>     

I think the problem comes from copying find_mode to find_control in stty.c.

static const struct mode_info *find_mode(const char *name)
{
        int i = 0;
        const char *m = mode_name;

        while (*m) {
                if (strcmp(name, m) == 0)
                        return &mode_info[i];
                m += strlen(m) + 1;
                i++;
        }
        return NULL;
}

static const struct control_info *find_control(const char *name)
{
        int i = 0;
-        const char *m = mode_name;
+        const char *m = control_name;

        while (*m) {
                if (strcmp(name, m) == 0)
                        return &control_info[i];
                m += strlen(m) + 1;
                i++;
        }
        return NULL;
}


Also there already is a function to return the index of a string 
(index_in_strings), so why not use it?

static const struct mode_info *find_mode(const char *name)
{
        int i = index_in_strings(mode_name, name);
        return i >= 0 ? &mode_info[i] : NULL;
}

static const struct control_info *find_control(const char *name)
{
        int i = index_in_strings(control_name, name);
        return i >= 0 ? &control_info[i] : NULL;
}


Regards
Ralf Friedl
_______________________________________________
busybox mailing list
[email protected]
http://busybox.net/cgi-bin/mailman/listinfo/busybox

Reply via email to