summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Bennett <steveb@workware.net.au>2019-08-08 20:32:40 +1000
committerSteve Bennett <steveb@workware.net.au>2019-11-12 07:33:05 +1000
commit76ddbec17c6084ab3333e4d5fa177241af1a91bb (patch)
tree7abd10133047033961b60e2ba25a22b6dbda2eeb
parent1618bed21e516633dcad123ed9149a05612b0c28 (diff)
aio: tty: allow setting echo
set-only e.g. to disable echo on stdin: stdin tty echo 0 This allows disabling echo while otherwise keeping cooked mode. Setting input to cooked or raw will overwrite this setting Signed-off-by: Steve Bennett <steveb@workware.net.au>
-rw-r--r--jim-aio.c2
-rw-r--r--jim-tty.c16
-rw-r--r--jim_tcl.txt5
3 files changed, 21 insertions, 2 deletions
diff --git a/jim-aio.c b/jim-aio.c
index 5557797..ddfc486 100644
--- a/jim-aio.c
+++ b/jim-aio.c
@@ -1762,7 +1762,7 @@ static const jim_subcmd_type aio_command_table[] = {
#endif
#if defined(HAVE_TERMIOS_H)
{ "tty",
- "?baud rate? ?data bits? ?stop bits? ?parity even|odd|none? ?handshake xonxoff|rtscts|none? ?input raw|cooked? ?output raw|cooked? ?vmin n? ?vtime n?",
+ "?baud rate? ?data bits? ?stop bits? ?parity even|odd|none? ?handshake xonxoff|rtscts|none? ?input raw|cooked? ?output raw|cooked? ?echo 0|1? ?vmin n? ?vtime n?",
aio_cmd_tty,
0,
-1,
diff --git a/jim-tty.c b/jim-tty.c
index 0ccab7b..5d9cee7 100644
--- a/jim-tty.c
+++ b/jim-tty.c
@@ -79,6 +79,7 @@ static const char * const tty_settings_names[] = {
"stop",
"vmin",
"vtime",
+ "echo",
NULL
};
@@ -91,7 +92,8 @@ enum {
OPT_PARITY,
OPT_STOP,
OPT_VMIN,
- OPT_VTIME
+ OPT_VTIME,
+ OPT_ECHO
};
@@ -319,6 +321,18 @@ badvalue:
}
break;
+ case OPT_ECHO:
+ if (Jim_GetLong(interp, valueObj, &l) != JIM_OK) {
+ goto badvalue;
+ }
+ if (l) {
+ tio.c_lflag |= ECHO;
+ }
+ else {
+ tio.c_lflag &= ~ECHO;
+ }
+ break;
+
}
}
diff --git a/jim_tcl.txt b/jim_tcl.txt
index 01c33b4..26cfd93 100644
--- a/jim_tcl.txt
+++ b/jim_tcl.txt
@@ -60,6 +60,7 @@ Changes since 0.78
4. Add `signal block` to prevent delivery of signals
5. Add support for `file split`
6. Add support for `json::encode` and `json::decode`
+7. `aio tty` now allows setting +echo+ without full +raw+ mode
Changes between 0.77 and 0.78
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -4855,6 +4856,10 @@ aio
+*output raw|cooked*+;;
Output character processing. Typically CR -> CRNL is disabled in raw mode.
+ +*echo 0|1*+;;
+ Disable or enable echo on input. Note that this is a set-only value.
+ Setting +input+ to +raw+ or +cooked+ will overwrite this setting.
+
+*vmin* 'numchars'+;;
Minimum number of characters to read.