diff options
author | mdejong <mdejong> | 2002-01-25 23:06:58 (GMT) |
---|---|---|
committer | mdejong <mdejong> | 2002-01-25 23:06:58 (GMT) |
commit | 727dc02ba3e05c4df81068bc3fd0ac3a8c98328b (patch) | |
tree | 75339e2bd4ffcbce34c5e3b7c788743e68e0c163 /generic | |
parent | fc040221576dad87475a85d33aba99c043e39c36 (diff) | |
download | tcl-727dc02ba3e05c4df81068bc3fd0ac3a8c98328b.zip tcl-727dc02ba3e05c4df81068bc3fd0ac3a8c98328b.tar.gz tcl-727dc02ba3e05c4df81068bc3fd0ac3a8c98328b.tar.bz2 |
Make -eofchar and -translation options read only for
server sockets. [Bug 496733]
* generic/tclIO.c (Tcl_GetChannelOption, Tcl_SetChannelOption):
Instead of returning nothing for the -translation option
on a server socket, always return "auto". Return the empty
string enclosed in quotes for the -eofchar option on
a server socket. Fixup -eofchar usage message so that
it matches the implementation.
* tests/io.test: Add -eofchar tests and -translation tests
to ensure options are read only on server sockets.
* tests/socket.test: Update tests to account for -eofchar
and -translation option changes.
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclIO.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/generic/tclIO.c b/generic/tclIO.c index 12df2a6..75f6d42 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.49 2002/01/25 20:40:55 dgp Exp $ + * RCS: @(#) $Id: tclIO.c,v 1.50 2002/01/25 23:06:58 mdejong Exp $ */ #include "tclInt.h" @@ -6096,6 +6096,10 @@ Tcl_GetChannelOption(interp, chan, optionName, dsPtr) Tcl_DStringAppendElement(dsPtr, buf); } } + if ( !(flags & (TCL_READABLE|TCL_WRITABLE))) { + /* Not readable or writable (server socket) */ + Tcl_DStringAppendElement(dsPtr, ""); + } if (((flags & (TCL_READABLE|TCL_WRITABLE)) == (TCL_READABLE|TCL_WRITABLE)) && (len == 0)) { Tcl_DStringEndSublist(dsPtr); @@ -6136,6 +6140,10 @@ Tcl_GetChannelOption(interp, chan, optionName, dsPtr) Tcl_DStringAppendElement(dsPtr, "lf"); } } + if ( !(flags & (TCL_READABLE|TCL_WRITABLE))) { + /* Not readable or writable (server socket) */ + Tcl_DStringAppendElement(dsPtr, "auto"); + } if (((flags & (TCL_READABLE|TCL_WRITABLE)) == (TCL_READABLE|TCL_WRITABLE)) && (len == 0)) { Tcl_DStringEndSublist(dsPtr); @@ -6305,8 +6313,8 @@ Tcl_SetChannelOption(interp, chan, optionName, newValue) } else if (argc != 2) { if (interp) { Tcl_AppendResult(interp, - "bad value for -eofchar: should be a list of one or", - " two elements", (char *) NULL); + "bad value for -eofchar: should be a list of zero,", + " one, or two elements", (char *) NULL); } ckfree((char *) argv); return TCL_ERROR; |