From 38e787d2a5bf25a1385bd7316b83c18523ae72b0 Mon Sep 17 00:00:00 2001 From: das Date: Tue, 9 Dec 2008 23:53:37 +0000 Subject: * macosx/tkMacOSXInit.c (TkpInit): unconditionally show Tk console if TK_CONSOLE env var is set. --- ChangeLog | 7 ++++++- macosx/tkMacOSXInit.c | 45 ++++++++++++++++++++++----------------------- 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 + + * macosx/tkMacOSXInit.c (TkpInit): unconditionally show Tk console + if TK_CONSOLE env var is set. + 2008-12-09 Don Porter - 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; + } } } -- cgit v0.12