diff options
| author | mdejong <mdejong> | 2002-01-25 23:06:58 (GMT) |
|---|---|---|
| committer | mdejong <mdejong> | 2002-01-25 23:06:58 (GMT) |
| commit | e1f4440350e89527ac73db798c47bf5fcc88f848 (patch) | |
| tree | 75339e2bd4ffcbce34c5e3b7c788743e68e0c163 /generic/tclIO.c | |
| parent | a5cc86f7a73f40cfc5114191b640c73ce0abc9f7 (diff) | |
| download | tcl-e1f4440350e89527ac73db798c47bf5fcc88f848.zip tcl-e1f4440350e89527ac73db798c47bf5fcc88f848.tar.gz tcl-e1f4440350e89527ac73db798c47bf5fcc88f848.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/tclIO.c')
| -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; |
