diff options
author | dkf <dkf@noemail.net> | 2005-06-07 10:04:46 (GMT) |
---|---|---|
committer | dkf <dkf@noemail.net> | 2005-06-07 10:04:46 (GMT) |
commit | 2fee09e16ffc644dd35399f940f497f827c7c786 (patch) | |
tree | db151d401631884701b22d31740507e5839dbd14 /generic/tclIOCmd.c | |
parent | 83abe7f3b2dbb8d2558ef9d1e372b0fd5ebeb7b3 (diff) | |
download | tcl-2fee09e16ffc644dd35399f940f497f827c7c786.zip tcl-2fee09e16ffc644dd35399f940f497f827c7c786.tar.gz tcl-2fee09e16ffc644dd35399f940f497f827c7c786.tar.bz2 |
Clean up tests in chan.test and add mechanism for chaining Tcl_WrongNumArgs
messages (used in [read] implementation)
FossilOrigin-Name: b3487bb8b81d80e8d373e29358e8173c871162bd
Diffstat (limited to 'generic/tclIOCmd.c')
-rw-r--r-- | generic/tclIOCmd.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/generic/tclIOCmd.c b/generic/tclIOCmd.c index 0d2f681..f33bde5 100644 --- a/generic/tclIOCmd.c +++ b/generic/tclIOCmd.c @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclIOCmd.c,v 1.26 2005/06/07 02:12:45 dgp Exp $ + * RCS: @(#) $Id: tclIOCmd.c,v 1.27 2005/06/07 10:05:00 dkf Exp $ */ #include "tclInt.h" @@ -305,10 +305,18 @@ Tcl_ReadObjCmd(dummy, interp, objc, objv) Tcl_Obj *resultPtr; if ((objc != 2) && (objc != 3)) { - argerror: + Interp *iPtr; + + argerror: + iPtr = (Interp *) interp; Tcl_WrongNumArgs(interp, 1, objv, "channelId ?numChars?"); - Tcl_AppendResult(interp, " or \"", Tcl_GetString(objv[0]), - " ?-nonewline? channelId\"", (char *) NULL); + /* + * Do not append directly; that makes ensembles using this + * command as a subcommand produce the wrong message. + */ + iPtr->flags |= INTERP_ALTERNATE_WRONG_ARGS; + Tcl_WrongNumArgs(interp, 1, objv, "?-nonewline? channelId"); + iPtr->flags &= ~INTERP_ALTERNATE_WRONG_ARGS; return TCL_ERROR; } |