Eric Pouech : kernel32: No longer init the terminfo database nor application key mode when 0 or 1 are not bound to a tty .
Alexandre Julliard
julliard at winehq.org
Tue Jan 25 12:01:41 CST 2011
Module: wine
Branch: master
Commit: ff057db6758e25167dafe92338a3d8895d6edd61
URL: http://source.winehq.org/git/wine.git/?a=commit;h=ff057db6758e25167dafe92338a3d8895d6edd61
Author: Eric Pouech <eric.pouech at orange.fr>
Date: Mon Jan 24 22:13:23 2011 +0100
kernel32: No longer init the terminfo database nor application key mode when 0 or 1 are not bound to a tty.
---
dlls/kernel32/term.c | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/dlls/kernel32/term.c b/dlls/kernel32/term.c
index 2dce31b..ee879e3 100644
--- a/dlls/kernel32/term.c
+++ b/dlls/kernel32/term.c
@@ -320,10 +320,15 @@ static BOOL TERM_BuildKeyDB(void)
return TRUE;
}
+static BOOL TERM_init_done /* = FALSE */;
+
BOOL TERM_Init(void)
{
+ /* if we're not attached to a tty, don't fire the curses support */
+ if (!isatty(0) || !isatty(1)) return FALSE;
if (!TERM_bind_libcurses()) return FALSE;
if (setupterm(NULL, 1 /* really ?? */, NULL) == -1) return FALSE;
+ TERM_init_done = TRUE;
TERM_BuildKeyDB();
/* set application key mode */
putp(tigetstr("smkx"));
@@ -332,8 +337,11 @@ BOOL TERM_Init(void)
BOOL TERM_Exit(void)
{
- /* put back the cursor key mode */
- putp(tigetstr("rmkx"));
+ if (TERM_init_done)
+ {
+ /* put back the cursor key mode */
+ putp(tigetstr("rmkx"));
+ }
return TRUE;
}
More information about the wine-cvs
mailing list