diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-04-19 19:55:54 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-04-19 19:55:54 +0000 |
commit | 9ace613406968c1f64b08f6869e51c321557f106 (patch) | |
tree | 7829db95da1dec4dfceed4d85b6c4082b0ad4c53 | |
parent | 05a6d9cbb202b8aa7379e39dfd09baccfbfc6c4b (diff) | |
download | busybox-w32-9ace613406968c1f64b08f6869e51c321557f106.tar.gz busybox-w32-9ace613406968c1f64b08f6869e51c321557f106.tar.bz2 busybox-w32-9ace613406968c1f64b08f6869e51c321557f106.zip |
stty: fix option parsing bug (spotted by Sascha Hauer <s.hauer@pengutronix.de>)
-rw-r--r-- | coreutils/stty.c | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/coreutils/stty.c b/coreutils/stty.c index 8757f247c..702cada63 100644 --- a/coreutils/stty.c +++ b/coreutils/stty.c | |||
@@ -550,24 +550,25 @@ static const struct control_info *find_control(const char *name) | |||
550 | 550 | ||
551 | enum { | 551 | enum { |
552 | param_need_arg = 0x80, | 552 | param_need_arg = 0x80, |
553 | param_line = 1 | 0x80, | 553 | param_line = 1 | 0x80, |
554 | param_rows = 2 | 0x80, | 554 | param_rows = 2 | 0x80, |
555 | param_cols = 3 | 0x80, | 555 | param_cols = 3 | 0x80, |
556 | param_size = 4, | 556 | param_columns = 4 | 0x80, |
557 | param_speed = 5, | 557 | param_size = 5, |
558 | param_ispeed = 6 | 0x80, | 558 | param_speed = 6, |
559 | param_ospeed = 7 | 0x80, | 559 | param_ispeed = 7 | 0x80, |
560 | param_ospeed = 8 | 0x80, | ||
560 | }; | 561 | }; |
561 | 562 | ||
562 | static int find_param(const char * const name) | 563 | static int find_param(const char * const name) |
563 | { | 564 | { |
564 | static const char * const params[] = { | 565 | static const char * const params[] = { |
565 | "line", | 566 | "line", /* 1 */ |
566 | "rows", | 567 | "rows", /* 2 */ |
567 | "cols", | 568 | "cols", /* 3 */ |
568 | "columns", | 569 | "columns", /* 4 */ |
569 | "size", /* 4 */ | 570 | "size", /* 5 */ |
570 | "speed", /* 5 */ | 571 | "ispeed"+1, /* 6 */ |
571 | "ispeed", | 572 | "ispeed", |
572 | "ospeed", | 573 | "ospeed", |
573 | NULL | 574 | NULL |
@@ -575,9 +576,8 @@ static int find_param(const char * const name) | |||
575 | int i = index_in_str_array(params, name) + 1; | 576 | int i = index_in_str_array(params, name) + 1; |
576 | if (i == 0) | 577 | if (i == 0) |
577 | return 0; | 578 | return 0; |
578 | if (!(i == 4 || i == 5)) | 579 | if (i != 5 && i != 6) |
579 | i |= 0x80; | 580 | i |= 0x80; |
580 | |||
581 | return i; | 581 | return i; |
582 | } | 582 | } |
583 | 583 | ||
@@ -1014,6 +1014,7 @@ int stty_main(int argc, char **argv) | |||
1014 | #ifdef TIOCGWINSZ | 1014 | #ifdef TIOCGWINSZ |
1015 | case param_rows: | 1015 | case param_rows: |
1016 | case param_cols: | 1016 | case param_cols: |
1017 | case param_columns: | ||
1017 | xatoul_range_sfx(argnext, 1, INT_MAX, stty_suffixes); | 1018 | xatoul_range_sfx(argnext, 1, INT_MAX, stty_suffixes); |
1018 | break; | 1019 | break; |
1019 | case param_size: | 1020 | case param_size: |