summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordas <das>2008-12-09 23:53:37 (GMT)
committerdas <das>2008-12-09 23:53:37 (GMT)
commit38e787d2a5bf25a1385bd7316b83c18523ae72b0 (patch)
tree3dbe7c3a849ee44cfced1b82d768e72f3d425055
parent0230a88f1896a7fd9ce09fd0056808c0174143a8 (diff)
downloadtk-38e787d2a5bf25a1385bd7316b83c18523ae72b0.zip
tk-38e787d2a5bf25a1385bd7316b83c18523ae72b0.tar.gz
tk-38e787d2a5bf25a1385bd7316b83c18523ae72b0.tar.bz2
* macosx/tkMacOSXInit.c (TkpInit): unconditionally show Tk console
if TK_CONSOLE env var is set.
-rw-r--r--ChangeLog7
-rw-r--r--macosx/tkMacOSXInit.c45
2 files changed, 28 insertions, 24 deletions
diff --git a/ChangeLog b/ChangeLog
index 5f5bbed..06f7c3b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,11 @@
+2008-12-10 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/tkMacOSXInit.c (TkpInit): unconditionally show Tk console
+ if TK_CONSOLE env var is set.
+
2008-12-09 Don Porter <dgp@users.sourceforge.net>
- TIP 337
+ TIP #337 IMPLEMENTATION
* generic/tkBind.c: Updated callers of Tcl_BackgroundError()
* generic/tkCanvas.c: to use the new routine
diff --git a/macosx/tkMacOSXInit.c b/macosx/tkMacOSXInit.c
index 7e2a996..85fb35a 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.36 2008/06/19 00:13:02 das Exp $
+ * RCS: @(#) $Id: tkMacOSXInit.c,v 1.37 2008/12/09 23:53:37 das Exp $
*/
#include "tkMacOSXPrivate.h"
@@ -134,6 +134,7 @@ TkpInit(
int i;
struct utsname name;
long osVersion = 0;
+ struct stat st;
initialized = 1;
@@ -350,33 +351,31 @@ TkpInit(
* clicking Wish) then use the Tk based console interpreter.
*/
- if (!isatty(0)) {
- struct stat st;
+ if (getenv("TK_CONSOLE") ||
+ (!isatty(0) && (fstat(0, &st) ||
+ (S_ISCHR(st.st_mode) && st.st_blocks == 0)))) {
+ Tk_InitConsoleChannels(interp);
+ Tcl_RegisterChannel(interp, Tcl_GetStdChannel(TCL_STDIN));
+ Tcl_RegisterChannel(interp, Tcl_GetStdChannel(TCL_STDOUT));
+ Tcl_RegisterChannel(interp, Tcl_GetStdChannel(TCL_STDERR));
- if (fstat(0, &st) || (S_ISCHR(st.st_mode) && st.st_blocks == 0)) {
- Tk_InitConsoleChannels(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
- * and tcl_interactive hasn't been set already.
- */
+ /*
+ * 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) {
- const char *intvar = Tcl_GetVar(interp,
- "tcl_interactive", TCL_GLOBAL_ONLY);
+ if (Tcl_GetStartupScript(NULL) == NULL) {
+ 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;
+ if (intvar == NULL) {
+ Tcl_SetVar(interp, "tcl_interactive", "1",
+ TCL_GLOBAL_ONLY);
}
}
+ if (Tk_CreateConsoleWindow(interp) == TCL_ERROR) {
+ return TCL_ERROR;
+ }
}
}