[git commit master 1/1] stty: enable line discipline display and change code if __linix__

Denys Vlasenko vda.linux at googlemail.com
Mon Jan 24 17:30:35 UTC 2011


commit: http://git.busybox.net/busybox/commit/?id=e54cfc5477def68dfe00f39ac0737f4eaeda27e9
branch: http://git.busybox.net/busybox/commit/?id=refs/heads/master

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 at googlemail.com>
---
 coreutils/stty.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/coreutils/stty.c b/coreutils/stty.c
index 25c00d1..1dd01c4 100644
--- a/coreutils/stty.c
+++ b/coreutils/stty.c
@@ -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;
-- 
1.7.3.4



More information about the busybox-cvs mailing list