summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2022-10-28 11:18:53 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2022-10-28 11:18:53 (GMT)
commit18fb3780723b2613640a274c1b76831ebceadfeb (patch)
tree0aae6637315656922453c773719a21ec0eee98ad /generic
parentd1e2a1ab3ccfb141e5336357b90666f94789c20d (diff)
downloadtcl-18fb3780723b2613640a274c1b76831ebceadfeb.zip
tcl-18fb3780723b2613640a274c1b76831ebceadfeb.tar.gz
tcl-18fb3780723b2613640a274c1b76831ebceadfeb.tar.bz2
TIP #646 correction: let "fconfigure $chan -eofchar" return a single character, not a list element
Diffstat (limited to 'generic')
-rw-r--r--generic/regc_locale.c2
-rw-r--r--generic/tclIO.c16
-rw-r--r--generic/tclIOUtil.c12
3 files changed, 15 insertions, 15 deletions
diff --git a/generic/regc_locale.c b/generic/regc_locale.c
index 7252b88..7d182e4 100644
--- a/generic/regc_locale.c
+++ b/generic/regc_locale.c
@@ -110,7 +110,7 @@ static const struct cname {
{"right-brace", '}'},
{"right-curly-bracket", '}'},
{"tilde", '~'},
- {"DEL", '\177'},
+ {"DEL", '\x7F'},
{NULL, 0}
};
diff --git a/generic/tclIO.c b/generic/tclIO.c
index 374f770..b3b62ed 100644
--- a/generic/tclIO.c
+++ b/generic/tclIO.c
@@ -7930,20 +7930,18 @@ Tcl_GetChannelOption(
}
}
if (len == 0 || HaveOpt(2, "-eofchar")) {
+ char buf[4] = "";
if (len == 0) {
Tcl_DStringAppendElement(dsPtr, "-eofchar");
}
- if (!(flags & TCL_READABLE) || (statePtr->inEofChar == 0)) {
- Tcl_DStringAppendElement(dsPtr, "");
- } else {
- char buf[4];
-
+ if ((flags & TCL_READABLE) && (statePtr->inEofChar != 0)) {
sprintf(buf, "%c", statePtr->inEofChar);
- Tcl_DStringAppendElement(dsPtr, buf);
}
if (len > 0) {
+ Tcl_DStringAppend(dsPtr, buf, TCL_INDEX_NONE);
return TCL_OK;
}
+ Tcl_DStringAppendElement(dsPtr, buf);
}
if (len == 0 || HaveOpt(1, "-nocomplainencoding")) {
if (len == 0) {
@@ -8181,6 +8179,7 @@ Tcl_SetChannelOption(
if (GotFlag(statePtr, TCL_READABLE)) {
statePtr->inEofChar = newValue[0];
}
+#ifndef TCL_NO_DEPRECATED
} else if (Tcl_SplitList(interp, newValue, &argc, &argv) == TCL_ERROR) {
return TCL_ERROR;
} else if (argc == 0) {
@@ -8201,11 +8200,12 @@ Tcl_SetChannelOption(
if (GotFlag(statePtr, TCL_READABLE)) {
statePtr->inEofChar = inValue;
}
+#endif
} else {
if (interp) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "bad value for -eofchar: should be a list of zero,"
- " one, or two elements", -1));
+ "bad value for -eofchar: must be non-NUL ASCII"
+ " character", -1));
}
Tcl_Free((void *)argv);
return TCL_ERROR;
diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c
index aa92754..470977e 100644
--- a/generic/tclIOUtil.c
+++ b/generic/tclIOUtil.c
@@ -1715,11 +1715,11 @@ Tcl_FSEvalFileEx(
}
/*
- * The eof character is \32 (^Z). This is standard on Windows, and Tcl
- * uses it on every platform to allow for scripted documents. [Bug: 2040]
+ * The eof character is \x1A (^Z). Tcl uses it on every platform to allow
+ * for scripted documents. [Bug: 2040]
*/
- Tcl_SetChannelOption(interp, chan, "-eofchar", "\32 {}");
+ Tcl_SetChannelOption(interp, chan, "-eofchar", "\x1A");
/*
* If the encoding is specified, set the channel to that encoding.
@@ -1851,11 +1851,11 @@ TclNREvalFile(
TclPkgFileSeen(interp, TclGetString(pathPtr));
/*
- * The eof character is \32 (^Z). This is standard on Windows, and Tcl
- * uses it on every platform to allow for scripted documents. [Bug: 2040]
+ * The eof character is \x1A (^Z). Tcl uses it on every platform to allow
+ * for scripted documents. [Bug: 2040]
*/
- Tcl_SetChannelOption(interp, chan, "-eofchar", "\32 {}");
+ Tcl_SetChannelOption(interp, chan, "-eofchar", "\x1A");
/*
* If the encoding is specified, set the channel to that encoding.