aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-01-27 23:24:31 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-01-27 23:24:31 +0000
commitda42bd5bbe6fdda12133e7305b1a3e7cee506cc8 (patch)
treedf7566cc1c7929958ac5137e984ccba755ec693e
parentef67c5758a3eeeac2a4cf57559ff967210f7feab (diff)
downloadbusybox-da42bd5bbe6fdda12133e7305b1a3e7cee506cc8.tar.gz
stty: fix mishandling of 'control' keywords (Ralf Friedl <Ralf.Friedl@online.de>)
-rw-r--r--coreutils/stty.c24
1 files changed, 4 insertions, 20 deletions
diff --git a/coreutils/stty.c b/coreutils/stty.c
index ade2468a8..298fb5b70 100644
--- a/coreutils/stty.c
+++ b/coreutils/stty.c
@@ -780,30 +780,14 @@ static const struct suffix_mult stty_suffixes[] = {
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 {