aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Bennett <steveb@workware.net.au>2020-05-05 21:45:41 +1000
committerSteve Bennett <steveb@workware.net.au>2024-02-04 10:08:26 +1000
commit474bab96aaa42526fdd5283a925e540679ae0bfe (patch)
tree50e7c2cb289c9475892f40789f916becacf513e6
parentdd22498a18f17f8b9f2c080f21f0310bf8c1880a (diff)
downloadjimtcl-474bab96aaa42526fdd5283a925e540679ae0bfe.zip
jimtcl-474bab96aaa42526fdd5283a925e540679ae0bfe.tar.gz
jimtcl-474bab96aaa42526fdd5283a925e540679ae0bfe.tar.bz2
aio: tty: Add support for vstart and vstop
xonxoff start and stop chars Signed-off-by: Steve Bennett <steveb@workware.net.au>
-rw-r--r--jim-aio.c2
-rw-r--r--jim-tty.c25
-rw-r--r--jim_tcl.txt6
-rw-r--r--tests/tty.test2
4 files changed, 25 insertions, 10 deletions
diff --git a/jim-aio.c b/jim-aio.c
index f199433..0805d41 100644
--- a/jim-aio.c
+++ b/jim-aio.c
@@ -2145,7 +2145,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? ?echo 0|1? ?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? ?vstart char? ?vstop char?",
aio_cmd_tty,
0,
-1,
diff --git a/jim-tty.c b/jim-tty.c
index b3faaba..534e65c 100644
--- a/jim-tty.c
+++ b/jim-tty.c
@@ -79,6 +79,8 @@ static const char * const tty_settings_names[] = {
"vmin",
"vtime",
"echo",
+ "vstart",
+ "vstop",
NULL
};
@@ -92,7 +94,9 @@ enum {
OPT_STOP,
OPT_VMIN,
OPT_VTIME,
- OPT_ECHO
+ OPT_ECHO,
+ OPT_VSTART,
+ OPT_VSTOP,
};
@@ -184,6 +188,10 @@ Jim_Obj *Jim_GetTtySettings(Jim_Interp *interp, int fd)
Jim_ListAppendElement(interp, listObjPtr, Jim_NewIntObj(interp, tio.c_cc[VMIN]));
Jim_ListAppendElement(interp, listObjPtr, Jim_NewStringObj(interp, "vtime", -1));
Jim_ListAppendElement(interp, listObjPtr, Jim_NewIntObj(interp, tio.c_cc[VTIME]));
+ Jim_ListAppendElement(interp, listObjPtr, Jim_NewStringObj(interp, "vstart", -1));
+ Jim_ListAppendElement(interp, listObjPtr, Jim_NewIntObj(interp, tio.c_cc[VSTART]));
+ Jim_ListAppendElement(interp, listObjPtr, Jim_NewStringObj(interp, "vstop", -1));
+ Jim_ListAppendElement(interp, listObjPtr, Jim_NewIntObj(interp, tio.c_cc[VSTOP]));
speed = cfgetispeed(&tio);
baud = 0;
@@ -283,17 +291,18 @@ badvalue:
break;
case OPT_VMIN:
- if (Jim_GetLong(interp, valueObj, &l) != JIM_OK) {
- goto badvalue;
- }
- tio.c_cc[VMIN] = l;
- break;
-
case OPT_VTIME:
+ case OPT_VSTART:
+ case OPT_VSTOP:
if (Jim_GetLong(interp, valueObj, &l) != JIM_OK) {
goto badvalue;
}
- tio.c_cc[VTIME] = l;
+ switch (opt) {
+ case OPT_VMIN: tio.c_cc[VMIN] = l; break;
+ case OPT_VTIME: tio.c_cc[VTIME] = l; break;
+ case OPT_VSTART: tio.c_cc[VSTART] = l; break;
+ case OPT_VSTOP: tio.c_cc[VSTOP] = l; break;
+ }
break;
case OPT_OUTPUT:
diff --git a/jim_tcl.txt b/jim_tcl.txt
index a92ba9f..05a2e26 100644
--- a/jim_tcl.txt
+++ b/jim_tcl.txt
@@ -5173,6 +5173,12 @@ This command returns an empty string.
+*vtime* 'time'+;;
Timeout for noncanonical read (units of 0.1 seconds)
+ +*vstart* 'char'+;;
+ Start character for xonoff, usually 0x11 (^Q)
+
+ +*vstop* 'char'+;;
+ Stop character for xonoff, usually 0x13 (^S)
+
+$handle *ssl* ?*-server* 'cert ?key?'|*-sni* 'servername'?+::
Upgrades the stream to a SSL/TLS session and returns the handle.
If +-server+ is specified, either both the certificate and private key files
diff --git a/tests/tty.test b/tests/tty.test
index 104683f..b710c78 100644
--- a/tests/tty.test
+++ b/tests/tty.test
@@ -25,7 +25,7 @@ test tty-1.1 {tty status} {
test tty-1.2 {tty bad param} -body {
$chan tty bad value
-} -returnCodes error -result {bad setting "bad": must be baud, data, echo, handshake, input, output, parity, stop, vmin, or vtime}
+} -returnCodes error -result {bad setting "bad": must be baud, data, echo, handshake, input, output, parity, stop, vmin, vstart, vstop, or vtime}
test tty-1.3 {tty bad baud} -body {
$chan tty baud 12345