summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2007-11-27 19:48:05 (GMT)
committerdgp <dgp@users.sourceforge.net>2007-11-27 19:48:05 (GMT)
commitb65175e0556b45c22a1e5b702ad58b49d436e5b9 (patch)
treeeefc2f76870f11bd1dc12b530300c880b34a4e82 /generic
parent5b704020810cc6cd47e7e04537036e7e2c3fdf37 (diff)
downloadtcl-b65175e0556b45c22a1e5b702ad58b49d436e5b9.zip
tcl-b65175e0556b45c22a1e5b702ad58b49d436e5b9.tar.gz
tcl-b65175e0556b45c22a1e5b702ad58b49d436e5b9.tar.bz2
* doc/chan.n: "Fix" the limitation on channel -eofchar
* doc/fconfigure.n: values to single byte characters by documenting * generic/tclIO.c: it and making it fail loudly. Thanks to * tests/chan.test: Stuart Cassoff for contributing the fix. [Bug 800753]
Diffstat (limited to 'generic')
-rw-r--r--generic/tclIO.c31
1 files changed, 18 insertions, 13 deletions
diff --git a/generic/tclIO.c b/generic/tclIO.c
index bdc3110..9af2e19 100644
--- a/generic/tclIO.c
+++ b/generic/tclIO.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclIO.c,v 1.129 2007/11/19 14:04:24 dkf Exp $
+ * RCS: @(#) $Id: tclIO.c,v 1.130 2007/11/27 19:48:12 dgp Exp $
*/
#include "tclInt.h"
@@ -7314,14 +7314,26 @@ Tcl_SetChannelOption(
if (argc == 0) {
statePtr->inEofChar = 0;
statePtr->outEofChar = 0;
- } else if (argc == 1) {
- if (statePtr->flags & TCL_WRITABLE) {
- statePtr->outEofChar = (int) argv[0][0];
+ } else if (argc == 1 || argc == 2) {
+ int outIndex = (argc - 1);
+ int inValue = (int) argv[0][0];
+ int outValue = (int) argv[outIndex][0];
+ if ((inValue < 0x01 || inValue > 0x7f) || (outValue < 0x01 || outValue > 0x7f)) {
+ if (interp) {
+ Tcl_AppendResult(interp,
+ "bad value for -eofchar: must be between 0x01 and 0x7f",
+ NULL);
+ }
+ ckfree((char *) argv);
+ return TCL_ERROR;
}
if (statePtr->flags & TCL_READABLE) {
- statePtr->inEofChar = (int) argv[0][0];
+ statePtr->inEofChar = inValue;
}
- } else if (argc != 2) {
+ if (statePtr->flags & TCL_WRITABLE) {
+ statePtr->outEofChar = outValue;
+ }
+ } else {
if (interp) {
Tcl_AppendResult(interp,
"bad value for -eofchar: should be a list of zero,"
@@ -7329,13 +7341,6 @@ Tcl_SetChannelOption(
}
ckfree((char *) argv);
return TCL_ERROR;
- } else {
- if (statePtr->flags & TCL_READABLE) {
- statePtr->inEofChar = (int) argv[0][0];
- }
- if (statePtr->flags & TCL_WRITABLE) {
- statePtr->outEofChar = (int) argv[1][0];
- }
}
if (argv != NULL) {
ckfree((char *) argv);