aboutsummaryrefslogtreecommitdiff
path: root/coreutils
diff options
context:
space:
mode:
authorGravatar Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>2007-01-17 19:45:14 +0000
committerGravatar Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>2007-01-17 19:45:14 +0000
commita6e31ad83431eff9a76bf40dada68f2d925c9f70 (patch)
tree0514d0d4a4cb95b2245b98a5efb1287f5d6766d7 /coreutils
parent4950f010f3cf7f37dd31ae5c97b52e0fb28f3d16 (diff)
downloadbusybox-a6e31ad83431eff9a76bf40dada68f2d925c9f70.tar.gz
busybox-a6e31ad83431eff9a76bf40dada68f2d925c9f70.tar.bz2
- rewrite find_param to use index_in_str_array
Diffstat (limited to 'coreutils')
-rw-r--r--coreutils/stty.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/coreutils/stty.c b/coreutils/stty.c
index 4d7d0660a..a78e15c07 100644
--- a/coreutils/stty.c
+++ b/coreutils/stty.c
@@ -615,8 +615,9 @@ enum {
param_ospeed = 7 | 0x80,
};
-static int find_param(const char *name)
+static int find_param(const char * const name)
{
+#if 0
#ifdef HAVE_C_LINE
if (streq(name, "line")) return param_line;
#endif
@@ -630,6 +631,25 @@ static int find_param(const char *name)
if (streq(name, "ispeed")) return param_ispeed;
if (streq(name, "ospeed")) return param_ospeed;
return 0;
+#else
+ const char * const params[] = {
+ "line",
+ "rows",
+ "cols",
+ "columns",
+ "size",
+ "speed",
+ "ispeed",
+ "ospeed",
+ NULL
+ };
+ int i = index_in_str_array(params, name);
+ if (i) {
+ if (!(i == 4 || i == 5))
+ i |= 0x80;
+ }
+ return i;
+#endif
}
static int recover_mode(const char *arg, struct termios *mode)