summaryrefslogtreecommitdiffstats
path: root/generic/tclCmdMZ.c
diff options
context:
space:
mode:
authorsebres <sebres@users.sourceforge.net>2017-03-06 20:18:35 (GMT)
committersebres <sebres@users.sourceforge.net>2017-03-06 20:18:35 (GMT)
commit9f13ce8038e4c27cab5d0ee977a61ca48bde2b73 (patch)
tree2c581478c211e56c314bcaaeef4a690e7da31ed7 /generic/tclCmdMZ.c
parentc88fb138612db4499a9e841453cd14bfd5db7224 (diff)
parentae0c48521551ffe6af28967e0c3b848836fb632e (diff)
downloadtcl-9f13ce8038e4c27cab5d0ee977a61ca48bde2b73.zip
tcl-9f13ce8038e4c27cab5d0ee977a61ca48bde2b73.tar.gz
tcl-9f13ce8038e4c27cab5d0ee977a61ca48bde2b73.tar.bz2
merge trunk
Diffstat (limited to 'generic/tclCmdMZ.c')
-rw-r--r--generic/tclCmdMZ.c30
1 files changed, 27 insertions, 3 deletions
diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c
index b0212c3..14ff5f0 100644
--- a/generic/tclCmdMZ.c
+++ b/generic/tclCmdMZ.c
@@ -990,8 +990,11 @@ TclNRSourceObjCmd(
{
const char *encodingName = NULL;
Tcl_Obj *fileName;
+ int result;
+ void **pkgFiles = NULL;
+ void *names = NULL;
- if (objc != 2 && objc !=4) {
+ if (objc < 2 || objc > 4) {
Tcl_WrongNumArgs(interp, 1, objv, "?-encoding name? fileName");
return TCL_ERROR;
}
@@ -1009,9 +1012,30 @@ TclNRSourceObjCmd(
return TCL_ERROR;
}
encodingName = TclGetString(objv[2]);
- }
+ } else if (objc == 3) {
+ /* Handle undocumented -nopkg option. This should only be
+ * used by the internal ::tcl::Pkg::source utility function. */
+ static const char *const nopkgoptions[] = {
+ "-nopkg", NULL
+ };
+ int index;
- return TclNREvalFile(interp, fileName, encodingName);
+ if (TCL_ERROR == Tcl_GetIndexFromObj(interp, objv[1], nopkgoptions,
+ "option", TCL_EXACT, &index)) {
+ return TCL_ERROR;
+ }
+ pkgFiles = Tcl_GetAssocData(interp, "tclPkgFiles", NULL);
+ /* Make sure that during the following TclNREvalFile no filenames
+ * are recorded for inclusion in the "package files" command */
+ names = *pkgFiles;
+ *pkgFiles = NULL;
+ }
+ result = TclNREvalFile(interp, fileName, encodingName);
+ if (pkgFiles) {
+ /* restore "tclPkgFiles" assocdata to how it was. */
+ *pkgFiles = names;
+ }
+ return result;
}
/*