stty: enable line discipline display and change code if __linix__

function                                             old     new   delta
stty_main                                           1242    1276     +34
do_display                                           419     431     +12
display_speed                                         90      81      -9
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/1 up/down: 46/-9)              Total: 37 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2011-01-24 18:30:35 +01:00
parent 7073964b5f
commit e54cfc5477

View File

@ -1004,8 +1004,9 @@ static void display_speed(const struct termios *mode, int fancy)
const char *fmt_str = "%lu %lu\n\0ispeed %lu baud; ospeed %lu baud;";
unsigned long ispeed, ospeed;
ospeed = ispeed = cfgetispeed(mode);
if (ispeed == 0 || ispeed == (ospeed = cfgetospeed(mode))) {
ispeed = cfgetispeed(mode);
ospeed = cfgetospeed(mode);
if (ispeed == 0 || ispeed == ospeed) {
ispeed = ospeed; /* in case ispeed was 0 */
//________ 0123 4 5 6 7 8 9
fmt_str = "%lu\n\0\0\0\0\0speed %lu baud;";
@ -1024,7 +1025,7 @@ static void do_display(const struct termios *mode, int all)
display_speed(mode, 1);
if (all)
display_window_size(1);
#ifdef HAVE_C_LINE
#ifdef __linux__
wrapf("line = %u;\n", mode->c_line);
#else
newline();
@ -1357,7 +1358,7 @@ int stty_main(int argc UNUSED_PARAM, char **argv)
}
switch (param) {
#ifdef HAVE_C_LINE
#ifdef __linux__
case param_line:
# ifndef TIOCGWINSZ
xatoul_range_sfx(argnext, 1, INT_MAX, stty_suffixes);
@ -1461,7 +1462,7 @@ int stty_main(int argc UNUSED_PARAM, char **argv)
}
switch (param) {
#ifdef HAVE_C_LINE
#ifdef __linux__
case param_line:
mode.c_line = xatoul_sfx(argnext, stty_suffixes);
stty_state |= STTY_require_set_attr;