diff options
author | das <das> | 2008-12-09 23:53:37 (GMT) |
---|---|---|
committer | das <das> | 2008-12-09 23:53:37 (GMT) |
commit | 38e787d2a5bf25a1385bd7316b83c18523ae72b0 (patch) | |
tree | 3dbe7c3a849ee44cfced1b82d768e72f3d425055 /macosx/tkMacOSXInit.c | |
parent | 0230a88f1896a7fd9ce09fd0056808c0174143a8 (diff) | |
download | tk-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.
Diffstat (limited to 'macosx/tkMacOSXInit.c')
-rw-r--r-- | macosx/tkMacOSXInit.c | 45 |
1 files changed, 22 insertions, 23 deletions
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; + } } } |