diff options
author | Fumitoshi UKAI <ukai@debian.or.jp> | 2003-12-08 16:06:33 +0000 |
---|---|---|
committer | Fumitoshi UKAI <ukai@debian.or.jp> | 2003-12-08 16:06:33 +0000 |
commit | a850e05763c196efb9325e6ce0455add9b34bdb9 (patch) | |
tree | c766bfcaafe748053e6be98cee4f27c350892ff9 /terms.c | |
parent | [w3m-dev 04011] accessing to an `https' URI with a fragment via a proxy (diff) | |
download | w3m-a850e05763c196efb9325e6ce0455add9b34bdb9.tar.gz w3m-a850e05763c196efb9325e6ce0455add9b34bdb9.zip |
Bug#217509: segfaults if TERM is not set
* terms.c (check_cygwin_console): check TERM==NULL
(set_tty): check TERM==NULL
From: Fumitoshi UKAI <ukai@debian.or.jp>
Diffstat (limited to '')
-rw-r--r-- | terms.c | 20 |
1 files changed, 12 insertions, 8 deletions
@@ -1,4 +1,4 @@ -/* $Id: terms.c,v 1.50 2003/10/05 18:52:51 ukai Exp $ */ +/* $Id: terms.c,v 1.51 2003/12/08 16:06:34 ukai Exp $ */ /* * An original curses library for EUC-kanji by Akinori ITO, December 1989 * revised by Akinori ITO, January 1995 @@ -220,7 +220,9 @@ check_cygwin_console(void) char *term = getenv("TERM"); HANDLE hWnd; - if (strncmp(term, "cygwin", 6) == 0) { + if (term == NULL) + term = DEFAULT_TERM; + if (term && strncmp(term, "cygwin", 6) == 0) { isWinConsole = 1; } if (isWinConsole) { @@ -485,12 +487,14 @@ set_tty(void) #ifdef USE_MOUSE { char *term = getenv("TERM"); - struct w3m_term_info *p; - for (p = w3m_term_info_list; p->term != NULL; p++) { - if (!strncmp(term, p->term, strlen(p->term))) { - is_xterm = p->mouse_flag; - break; - } + if (term != NULL) { + struct w3m_term_info *p; + for (p = w3m_term_info_list; p->term != NULL; p++) { + if (!strncmp(term, p->term, strlen(p->term))) { + is_xterm = p->mouse_flag; + break; + } + } } } #endif |