summaryrefslogtreecommitdiffstats
path: root/generic/tclCmdMZ.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tclCmdMZ.c')
-rw-r--r--generic/tclCmdMZ.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c
index 33fc59f..64fc82c 100644
--- a/generic/tclCmdMZ.c
+++ b/generic/tclCmdMZ.c
@@ -14,7 +14,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclCmdMZ.c,v 1.93 2003/07/04 10:30:27 dkf Exp $
+ * RCS: @(#) $Id: tclCmdMZ.c,v 1.94 2003/09/05 21:52:11 dgp Exp $
*/
#include "tclInt.h"
@@ -1004,12 +1004,26 @@ Tcl_SourceObjCmd(dummy, interp, objc, objv)
int objc; /* Number of arguments. */
Tcl_Obj *CONST objv[]; /* Argument objects. */
{
- if (objc != 2) {
- Tcl_WrongNumArgs(interp, 1, objv, "fileName");
+ CONST char *encodingName = NULL;
+ Tcl_Obj *fileName;
+
+ if (objc != 2 && objc !=4) {
+ Tcl_WrongNumArgs(interp, 1, objv, "?-encoding name? fileName");
return TCL_ERROR;
}
-
- return Tcl_FSEvalFile(interp, objv[1]);
+ fileName = objv[objc-1];
+ if (objc == 4) {
+ static CONST char *options[] = {
+ "-encoding", (char *) NULL
+ };
+ int index;
+ if (TCL_ERROR == Tcl_GetIndexFromObj(interp, objv[1],
+ options, "option", TCL_EXACT, &index)) {
+ return TCL_ERROR;
+ }
+ encodingName = Tcl_GetString(objv[2]);
+ }
+ return Tcl_FSEvalFileEx(interp, fileName, encodingName);
}
/*