diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2012-06-25 12:57:50 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2012-06-25 12:57:50 (GMT) |
commit | 54096927a3f71635771813b5ceb91110ac92011e (patch) | |
tree | 6f7fbc2ac8742c8c3c00c0f6ba91990ac9e00498 /generic | |
parent | 076eb7c9e473f60d3821b1fcc622f69fbb8eba14 (diff) | |
parent | 527a4f67fa396747502ba37514a882725f401110 (diff) | |
download | tcl-54096927a3f71635771813b5ceb91110ac92011e.zip tcl-54096927a3f71635771813b5ceb91110ac92011e.tar.gz tcl-54096927a3f71635771813b5ceb91110ac92011e.tar.bz2 |
[Bug 3537605]: Make [encoding dirs ? ?] report the right error message.
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclCmdAH.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/generic/tclCmdAH.c b/generic/tclCmdAH.c index 4292224..6dfc705 100644 --- a/generic/tclCmdAH.c +++ b/generic/tclCmdAH.c @@ -629,24 +629,26 @@ EncodingDirsObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { + Tcl_Obj *dirListObj; + if (objc > 3) { - Tcl_WrongNumArgs(interp, 1, objv, "?dirList?"); + Tcl_WrongNumArgs(interp, 2, objv, "?dirList?"); return TCL_ERROR; } - objc -= 1; - objv += 1; - if (objc == 1) { + if (objc == 2) { Tcl_SetObjResult(interp, Tcl_GetEncodingSearchPath()); return TCL_OK; } - if (Tcl_SetEncodingSearchPath(objv[1]) == TCL_ERROR) { + + dirListObj = objv[2]; + if (Tcl_SetEncodingSearchPath(dirListObj) == TCL_ERROR) { Tcl_AppendResult(interp, "expected directory list but got \"", - TclGetString(objv[1]), "\"", NULL); + TclGetString(dirListObj), "\"", NULL); Tcl_SetErrorCode(interp, "TCL", "OPERATION", "ENCODING", "BADPATH", NULL); return TCL_ERROR; } - Tcl_SetObjResult(interp, objv[1]); + Tcl_SetObjResult(interp, dirListObj); return TCL_OK; } |