diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2019-03-27 13:54:18 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2019-03-27 13:54:18 (GMT) |
commit | bc322bfae7b2bcfc1c9946a184ddf7a7c7e5d4e1 (patch) | |
tree | edd3ae5ba2a512617e59cb7e7b16928e396d3d5e /unix | |
parent | 7ff500ca4d515a5bbf1b6b4442d857c369c727fd (diff) | |
download | tcl-bc322bfae7b2bcfc1c9946a184ddf7a7c7e5d4e1.zip tcl-bc322bfae7b2bcfc1c9946a184ddf7a7c7e5d4e1.tar.gz tcl-bc322bfae7b2bcfc1c9946a184ddf7a7c7e5d4e1.tar.bz2 |
Partial implementation on Windows. UNTESTED
Diffstat (limited to 'unix')
-rw-r--r-- | unix/tclUnixChan.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/unix/tclUnixChan.c b/unix/tclUnixChan.c index 605e317..152de88 100644 --- a/unix/tclUnixChan.c +++ b/unix/tclUnixChan.c @@ -979,6 +979,7 @@ TtyGetOptionProc( unsigned int len; char buf[3*TCL_INTEGER_SPACE + 16]; int valid = 0; /* Flag if valid option parsed. */ + struct termios iostate; if (optionName == NULL) { len = 0; @@ -1018,10 +1019,15 @@ TtyGetOptionProc( Tcl_DStringAppendElement(dsPtr, "-inputmode"); } if (len==0 || (len>1 && strncmp(optionName, "-inputmode", len)==0)) { - struct termios iostate; - valid = 1; - tcgetattr(fsPtr->fileState.fd, &iostate); + if (tcgetattr(fsPtr->fileState.fd, &iostate) < 0) { + if (interp != NULL) { + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "couldn't read serial terminal control state: %s", + Tcl_PosixError(interp))); + } + return TCL_ERROR; + } if (iostate.c_lflag & ICANON) { if (iostate.c_lflag & ECHO) { Tcl_DStringAppendElement(dsPtr, "normal"); @@ -1058,7 +1064,6 @@ TtyGetOptionProc( Tcl_DStringStartSublist(dsPtr); } if (len==0 || (len>1 && strncmp(optionName, "-xchar", len)==0)) { - struct termios iostate; Tcl_DString ds; valid = 1; |