stty: invalid number 'erase'
Ralf Friedl
Ralf.Friedl at online.de
Fri Jan 25 12:58:06 UTC 2008
Bernhard Fischer wrote:
> On Tue, Jan 15, 2008 at 03:44:32PM +0100, Ralf Friedl wrote:
>
>> 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.
>> Also there already is a function to return the index of a string
>> (index_in_strings), so why not use it?
>>
>
> Can you please send a complete, tested patch?
I already sent this a week ago. Is something wrong with the patch or did it simply get lost?
Regards
Ralf Friedl
--- coreutils/stty.c~ 2007-11-24 12:02:30.000000000 +0100
+++ coreutils/stty.c 2008-01-15 15:40:32.000000000 +0100
@@ -780,30 +780,14 @@
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;
+ 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 = 0;
- const char *m = mode_name;
-
- while (*m) {
- if (strcmp(name, m) == 0)
- return &control_info[i];
- m += strlen(m) + 1;
- i++;
- }
- return NULL;
+ int i = index_in_strings(control_name, name);
+ return i >= 0 ? &control_info[i] : NULL;
}
enum {
More information about the busybox
mailing list