diff options
author | Elliott Hughes <enh@google.com> | 2017-01-15 10:51:55 -0800 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2017-01-17 14:10:05 -0600 |
commit | 65fd7653b9f4de67a5cba2715e2226caad8b69aa (patch) | |
tree | c801467b2d5cc2a5606cf14cfba5dbff388b9908 /toys | |
parent | 12fcf08b5c96238530148d7d9975642b2299e39a (diff) | |
download | toybox-65fd7653b9f4de67a5cba2715e2226caad8b69aa.tar.gz |
Fix microcom command-line help and -X.
Diffstat (limited to 'toys')
-rw-r--r-- | toys/pending/microcom.c | 15 |
1 files 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); } } } |