diff options
author | oehhar <harald.oehlmann@elmicron.de> | 2022-09-11 09:55:09 (GMT) |
---|---|---|
committer | oehhar <harald.oehlmann@elmicron.de> | 2022-09-11 09:55:09 (GMT) |
commit | 14086d3b4aca32f2aa71c2799862593f2db4e0fd (patch) | |
tree | b193e17970e54dcb2d11a71e376ae89ec9fedb41 /generic/tclIO.c | |
parent | 77334ba0ad75d22574c957a65fff91ea17e3bc8e (diff) | |
download | tcl-14086d3b4aca32f2aa71c2799862593f2db4e0fd.zip tcl-14086d3b4aca32f2aa71c2799862593f2db4e0fd.tar.gz tcl-14086d3b4aca32f2aa71c2799862593f2db4e0fd.tar.bz2 |
TIP633 fconfigure -strictencoding: TCL 9 command line implementation
Diffstat (limited to 'generic/tclIO.c')
-rw-r--r-- | generic/tclIO.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/generic/tclIO.c b/generic/tclIO.c index 5317e30..d8a9760 100644 --- a/generic/tclIO.c +++ b/generic/tclIO.c @@ -7869,6 +7869,19 @@ Tcl_GetChannelOption( return TCL_OK; } } + if (len == 0 || HaveOpt(1, "-strictencoding")) { + if (len == 0) { + Tcl_DStringAppendElement(dsPtr, "-strictencoding"); + } + Tcl_DStringAppendElement(dsPtr, + (flags & CHANNEL_ENCODING_NOCOMPLAIN) ? "0" : "1"); + if (len > 0) { + return TCL_OK; + } + if (len > 0) { + return TCL_OK; + } + } if (len == 0 || HaveOpt(1, "-translation")) { if (len == 0) { Tcl_DStringAppendElement(dsPtr, "-translation"); @@ -8132,6 +8145,18 @@ Tcl_SetChannelOption( ResetFlag(statePtr, CHANNEL_EOF|CHANNEL_STICKY_EOF|CHANNEL_BLOCKED); statePtr->inputEncodingFlags &= ~TCL_ENCODING_END; return TCL_OK; + } else if (HaveOpt(1, "-strictencoding")) { + int newMode; + + if (Tcl_GetBoolean(interp, newValue, &newMode) == TCL_ERROR) { + return TCL_ERROR; + } + if (newMode) { + statePtr->flags &= ~CHANNEL_ENCODING_NOCOMPLAIN; + } else { + statePtr->flags |= CHANNEL_ENCODING_NOCOMPLAIN; + } + return TCL_OK; } else if (HaveOpt(1, "-translation")) { const char *readMode, *writeMode; |