diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-09-30 14:29:16 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-09-30 14:29:16 (GMT) |
commit | 195ea285daa186e7d78e1c8c99e4e5dfe373a603 (patch) | |
tree | f628e7606e7d3b0573ec4975e8ab8b798cc7352b /generic | |
parent | 20d206c4c2207a55f0d7bb4f0f81175deef3074f (diff) | |
download | tcl-195ea285daa186e7d78e1c8c99e4e5dfe373a603.zip tcl-195ea285daa186e7d78e1c8c99e4e5dfe373a603.tar.gz tcl-195ea285daa186e7d78e1c8c99e4e5dfe373a603.tar.bz2 |
TIP #581 tweak: Don't report "slaves" as valid option for "interp"
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclInterp.c | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/generic/tclInterp.c b/generic/tclInterp.c index 6417668..434d9f4 100644 --- a/generic/tclInterp.c +++ b/generic/tclInterp.c @@ -621,30 +621,41 @@ NRInterpCmd( static const char *const options[] = { "alias", "aliases", "bgerror", "cancel", "children", "create", "debug", "delete", + "eval", "exists", "expose", "hide", + "hidden", "issafe", "invokehidden", + "limit", "marktrusted", "recursionlimit", + "share", "slaves", "target", "transfer", + NULL + }; + static const char *const optionsNoSlaves[] = { + "alias", "aliases", "bgerror", "cancel", + "children", "create", "debug", "delete", "eval", "exists", "expose", "hide", "hidden", "issafe", "invokehidden", "limit", "marktrusted", "recursionlimit", - "slaves", "share", "target", "transfer", - NULL + "share", "target", "transfer", NULL }; enum option { OPT_ALIAS, OPT_ALIASES, OPT_BGERROR, OPT_CANCEL, OPT_CHILDREN, OPT_CREATE, OPT_DEBUG, OPT_DELETE, - OPT_EVAL, OPT_EXISTS, OPT_EXPOSE, - OPT_HIDE, OPT_HIDDEN, OPT_ISSAFE, - OPT_INVOKEHID, OPT_LIMIT, OPT_MARKTRUSTED,OPT_RECLIMIT, - OPT_SLAVES, OPT_SHARE, OPT_TARGET, OPT_TRANSFER + OPT_EVAL, OPT_EXISTS, OPT_EXPOSE, OPT_HIDE, + OPT_HIDDEN, OPT_ISSAFE, OPT_INVOKEHID, + OPT_LIMIT, OPT_MARKTRUSTED,OPT_RECLIMIT, + OPT_SHARE, OPT_SLAVES, OPT_TARGET, OPT_TRANSFER }; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "cmd ?arg ...?"); return TCL_ERROR; } - if (Tcl_GetIndexFromObj(interp, objv[1], options, "option", 0, - &index) != TCL_OK) { + if (Tcl_GetIndexFromObj(NULL, objv[1], options, + "option", 0, &index) != TCL_OK) { + /* Don't report the "slaves" option as possibility */ + Tcl_GetIndexFromObj(interp, objv[1], optionsNoSlaves, + "option", 0, &index); return TCL_ERROR; } - switch ((enum option) index) { + switch ((enum option)index) { case OPT_ALIAS: { Tcl_Interp *parentInterp; |