summaryrefslogtreecommitdiffstats
path: root/macosx/tkMacOSXInit.c
diff options
context:
space:
mode:
authorhobbs <hobbs@noemail.net>2006-11-24 19:03:49 (GMT)
committerhobbs <hobbs@noemail.net>2006-11-24 19:03:49 (GMT)
commit4e47170f279444d4bf7352b54a19062277b1f6c1 (patch)
treec4dd4bb1b1b95fa4b1f6d03510c4dcbb6e0addb8 /macosx/tkMacOSXInit.c
parentafe27ef22105774c1172f66afa99bd40151faafe (diff)
downloadtk-4e47170f279444d4bf7352b54a19062277b1f6c1.zip
tk-4e47170f279444d4bf7352b54a19062277b1f6c1.tar.gz
tk-4e47170f279444d4bf7352b54a19062277b1f6c1.tar.bz2
* macosx/tkMacOSXInit.c (TkpInit): only set tcl_interactive 1 if
it isn't already defined. Allows embedders to set it to 0 to prevent the console appearing on OS X. [Bug 1487701] FossilOrigin-Name: 9901d3eab0e599b5fb0a586ef1712201c5b77dca
Diffstat (limited to 'macosx/tkMacOSXInit.c')
-rw-r--r--macosx/tkMacOSXInit.c34
1 files changed, 21 insertions, 13 deletions
diff --git a/macosx/tkMacOSXInit.c b/macosx/tkMacOSXInit.c
index cc4f062..d3492c4 100644
--- a/macosx/tkMacOSXInit.c
+++ b/macosx/tkMacOSXInit.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMacOSXInit.c,v 1.24 2006/10/16 15:35:28 das Exp $
+ * RCS: @(#) $Id: tkMacOSXInit.c,v 1.25 2006/11/24 19:03:50 hobbs Exp $
*/
#include "tkMacOSXInt.h"
@@ -224,12 +224,6 @@ TkpInit(interp)
}
}
- /*
- * If we don't have a TTY and stdin is a special character file of length 0,
- * (e.g. /dev/null, which is what Finder sets when double clicking Wish)
- * then use the Tk based console interpreter.
- */
-
/* REMOVE ME: Close stdin & stdout for remote debugging otherwise we
* will fight with gdb for stdin & stdout
*/
@@ -239,6 +233,12 @@ TkpInit(interp)
close (1);
}
+ /*
+ * If we don't have a TTY and stdin is a special character file of
+ * length 0, (e.g. /dev/null, which is what Finder sets when double
+ * clicking Wish) then use the Tk based console interpreter.
+ */
+
if (!isatty(0)) {
struct stat st;
if (fstat(0, &st) || (S_ISCHR(st.st_mode) && st.st_blocks == 0)) {
@@ -246,9 +246,17 @@ TkpInit(interp)
Tcl_RegisterChannel(interp, Tcl_GetStdChannel(TCL_STDIN));
Tcl_RegisterChannel(interp, Tcl_GetStdChannel(TCL_STDOUT));
Tcl_RegisterChannel(interp, Tcl_GetStdChannel(TCL_STDERR));
- /* Only show the console if we don't have a startup script */
+ /*
+ * Only show the console if we don't have a startup script
+ * and tcl_interactive hasn't been set already.
+ */
if (Tcl_GetStartupScript(NULL) == NULL) {
- Tcl_SetVar(interp, "tcl_interactive", "1", TCL_GLOBAL_ONLY);
+ CONST char *intvar =
+ Tcl_GetVar(interp, "tcl_interactive", TCL_GLOBAL_ONLY);
+ if (intvar == NULL) {
+ Tcl_SetVar(interp, "tcl_interactive", "1",
+ TCL_GLOBAL_ONLY);
+ }
}
if (Tk_CreateConsoleWindow(interp) == TCL_ERROR) {
return TCL_ERROR;
@@ -257,10 +265,10 @@ TkpInit(interp)
}
/*
- * If we are loaded into an executable that is not a bundled application,
- * the window server does not let us come to the foreground.
- * For such an executable, notify the window server that we are now a
- * full GUI application.
+ * If we are loaded into an executable that is not a bundled
+ * application, the window server does not let us come to the
+ * foreground. For such an executable, notify the window server that
+ * we are now a full GUI application.
*/
{
/* Check whether we are a bundled executable: */