Commit ff057db6 authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

kernel32: No longer init the terminfo database nor application key mode when 0…

kernel32: No longer init the terminfo database nor application key mode when 0 or 1 are not bound to a tty.
parent 5f2370b0
...@@ -320,10 +320,15 @@ static BOOL TERM_BuildKeyDB(void) ...@@ -320,10 +320,15 @@ static BOOL TERM_BuildKeyDB(void)
return TRUE; return TRUE;
} }
static BOOL TERM_init_done /* = FALSE */;
BOOL TERM_Init(void) 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 (!TERM_bind_libcurses()) return FALSE;
if (setupterm(NULL, 1 /* really ?? */, NULL) == -1) return FALSE; if (setupterm(NULL, 1 /* really ?? */, NULL) == -1) return FALSE;
TERM_init_done = TRUE;
TERM_BuildKeyDB(); TERM_BuildKeyDB();
/* set application key mode */ /* set application key mode */
putp(tigetstr("smkx")); putp(tigetstr("smkx"));
...@@ -332,8 +337,11 @@ BOOL TERM_Init(void) ...@@ -332,8 +337,11 @@ BOOL TERM_Init(void)
BOOL TERM_Exit(void) BOOL TERM_Exit(void)
{ {
/* put back the cursor key mode */ if (TERM_init_done)
putp(tigetstr("rmkx")); {
/* put back the cursor key mode */
putp(tigetstr("rmkx"));
}
return TRUE; return TRUE;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment