diff options
author | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2007-01-17 19:45:14 +0000 |
---|---|---|
committer | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2007-01-17 19:45:14 +0000 |
commit | a6e31ad83431eff9a76bf40dada68f2d925c9f70 (patch) | |
tree | 0514d0d4a4cb95b2245b98a5efb1287f5d6766d7 /coreutils/stty.c | |
parent | 4950f010f3cf7f37dd31ae5c97b52e0fb28f3d16 (diff) | |
download | busybox-w32-a6e31ad83431eff9a76bf40dada68f2d925c9f70.tar.gz busybox-w32-a6e31ad83431eff9a76bf40dada68f2d925c9f70.tar.bz2 busybox-w32-a6e31ad83431eff9a76bf40dada68f2d925c9f70.zip |
- rewrite find_param to use index_in_str_array
Diffstat (limited to 'coreutils/stty.c')
-rw-r--r-- | coreutils/stty.c | 22 |
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 { | |||
615 | param_ospeed = 7 | 0x80, | 615 | param_ospeed = 7 | 0x80, |
616 | }; | 616 | }; |
617 | 617 | ||
618 | static int find_param(const char *name) | 618 | static int find_param(const char * const name) |
619 | { | 619 | { |
620 | #if 0 | ||
620 | #ifdef HAVE_C_LINE | 621 | #ifdef HAVE_C_LINE |
621 | if (streq(name, "line")) return param_line; | 622 | if (streq(name, "line")) return param_line; |
622 | #endif | 623 | #endif |
@@ -630,6 +631,25 @@ static int find_param(const char *name) | |||
630 | if (streq(name, "ispeed")) return param_ispeed; | 631 | if (streq(name, "ispeed")) return param_ispeed; |
631 | if (streq(name, "ospeed")) return param_ospeed; | 632 | if (streq(name, "ospeed")) return param_ospeed; |
632 | return 0; | 633 | return 0; |
634 | #else | ||
635 | const char * const params[] = { | ||
636 | "line", | ||
637 | "rows", | ||
638 | "cols", | ||
639 | "columns", | ||
640 | "size", | ||
641 | "speed", | ||
642 | "ispeed", | ||
643 | "ospeed", | ||
644 | NULL | ||
645 | }; | ||
646 | int i = index_in_str_array(params, name); | ||
647 | if (i) { | ||
648 | if (!(i == 4 || i == 5)) | ||
649 | i |= 0x80; | ||
650 | } | ||
651 | return i; | ||
652 | #endif | ||
633 | } | 653 | } |
634 | 654 | ||
635 | static int recover_mode(const char *arg, struct termios *mode) | 655 | static int recover_mode(const char *arg, struct termios *mode) |