summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorhobbs <hobbs>2002-09-02 19:16:23 (GMT)
committerhobbs <hobbs>2002-09-02 19:16:23 (GMT)
commit0d02b5679eab39cae732f7ff18838de80de1affd (patch)
tree57a4ac634f6f7502add4d42adfdda01e1f07236f /generic
parentc61554d78aab623bdfd1b7e78550578f2bb71866 (diff)
downloadtk-0d02b5679eab39cae732f7ff18838de80de1affd.zip
tk-0d02b5679eab39cae732f7ff18838de80de1affd.tar.gz
tk-0d02b5679eab39cae732f7ff18838de80de1affd.tar.bz2
* generic/tkCmds.c:
* generic/tkWindow.c: made 'tk' available in safe interpreters, but only the caret and windowingsystem subcommands may be called. * tests/safe.test (safe-1.2): noted that tk is now available in safe interps, but not the appname/scaling subcommands.
Diffstat (limited to 'generic')
-rw-r--r--generic/tkCmds.c35
-rw-r--r--generic/tkWindow.c4
2 files changed, 30 insertions, 9 deletions
diff --git a/generic/tkCmds.c b/generic/tkCmds.c
index 28da6e4..e84ba83 100644
--- a/generic/tkCmds.c
+++ b/generic/tkCmds.c
@@ -11,14 +11,14 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkCmds.c,v 1.30 2002/08/31 06:12:20 das Exp $
+ * RCS: @(#) $Id: tkCmds.c,v 1.31 2002/09/02 19:16:23 hobbs Exp $
*/
#include "tkPort.h"
#include "tkInt.h"
#include <errno.h>
-#if defined(__WIN32__)
+#if defined(WIN32)
#include "tkWinInt.h"
#elif defined(MAC_TCL)
#include "tkMacInt.h"
@@ -644,6 +644,13 @@ Tk_TkObjCmd(clientData, interp, objc, objv)
TkWindow *winPtr;
char *string;
+ if (Tcl_IsSafe(interp)) {
+ Tcl_SetResult(interp,
+ "appname not accessible in a safe interpreter",
+ TCL_STATIC);
+ return TCL_ERROR;
+ }
+
winPtr = (TkWindow *) tkwin;
if (objc > 3) {
@@ -741,6 +748,13 @@ Tk_TkObjCmd(clientData, interp, objc, objv)
int skip, width, height;
double d;
+ if (Tcl_IsSafe(interp)) {
+ Tcl_SetResult(interp,
+ "scaling not accessible in a safe interpreter",
+ TCL_STATIC);
+ return TCL_ERROR;
+ }
+
screenPtr = Tk_Screen(tkwin);
skip = TkGetDisplayOf(interp, objc - 2, objv + 2, &tkwin);
@@ -778,6 +792,13 @@ Tk_TkObjCmd(clientData, interp, objc, objv)
TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
int skip;
+ if (Tcl_IsSafe(interp)) {
+ Tcl_SetResult(interp,
+ "useinputmethods not accessible in a safe interpreter",
+ TCL_STATIC);
+ return TCL_ERROR;
+ }
+
skip = TkGetDisplayOf(interp, objc-2, objv+2, &tkwin);
if (skip < 0) {
return TCL_ERROR;
@@ -819,15 +840,15 @@ Tk_TkObjCmd(clientData, interp, objc, objv)
Tcl_WrongNumArgs(interp, 2, objv, NULL);
return TCL_ERROR;
}
- #if defined(__WIN32__) || defined(_WIN32)
+#if defined(WIN32)
windowingsystem = "win32";
- #elif defined(MAC_TCL)
+#elif defined(MAC_TCL)
windowingsystem = "classic";
- #elif defined(MAC_OSX_TK)
+#elif defined(MAC_OSX_TK)
windowingsystem = "aqua";
- #else
+#else
windowingsystem = "x11";
- #endif
+#endif
Tcl_SetStringObj(Tcl_GetObjResult(interp), windowingsystem, -1);
break;
}
diff --git a/generic/tkWindow.c b/generic/tkWindow.c
index a69c681..d358cbf 100644
--- a/generic/tkWindow.c
+++ b/generic/tkWindow.c
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkWindow.c,v 1.53 2002/08/31 06:12:28 das Exp $
+ * RCS: @(#) $Id: tkWindow.c,v 1.54 2002/09/02 19:16:23 hobbs Exp $
*/
#include "tkPort.h"
@@ -114,7 +114,7 @@ static TkCmd commands[] = {
{"place", NULL, Tk_PlaceObjCmd, 1, 0},
{"raise", NULL, Tk_RaiseObjCmd, 1, 1},
{"selection", NULL, Tk_SelectionObjCmd, 0, 1},
- {"tk", NULL, Tk_TkObjCmd, 0, 1},
+ {"tk", NULL, Tk_TkObjCmd, 1, 1},
{"tkwait", NULL, Tk_TkwaitObjCmd, 1, 1},
#if defined(__WIN32__) || defined(MAC_TCL) || defined(MAC_OSX_TK)
{"tk_chooseColor", NULL, Tk_ChooseColorObjCmd, 0, 1},