From 65fd7653b9f4de67a5cba2715e2226caad8b69aa Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Sun, 15 Jan 2017 10:51:55 -0800 Subject: Fix microcom command-line help and -X. --- toys/pending/microcom.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/toys/pending/microcom.c b/toys/pending/microcom.c index d41a9a21..38983ee1 100644 --- a/toys/pending/microcom.c +++ b/toys/pending/microcom.c @@ -8,7 +8,7 @@ config MICROCOM bool "microcom" default n help - usage: microcom [-s SPEED] [-X] + usage: microcom [-s SPEED] [-X] DEVICE Simple serial console. @@ -94,11 +94,14 @@ void microcom_main(void) // Read from stdin, write to connection. if (fds[1].revents) { - if (read(0, buf, 1) == 1) { - if (buf[0] == 0) tcsendbreak(TT.fd, 0); - else if (buf[0] == ('X'-'@')) break; - else xwrite(TT.fd, buf, 1); - } else break; + if (read(0, buf, 1) != 1) break; + if (!(toys.optflags & FLAG_X)) { + if (buf[0] == 0) { + tcsendbreak(TT.fd, 0); + continue; + } else if (buf[0] == ('X'-'@')) break; + } + xwrite(TT.fd, buf, 1); } } } -- cgit v1.2.3