2005-10-31 Andrew Stubbs <andrew.stubbs@st.com>

* tui/tui-command.c (tui_dispatch_ctrl_char): Test output of
	getenv() before using it.
This commit is contained in:
Andrew Stubbs 2005-10-31 19:11:35 +00:00
parent fb10537e39
commit bbe6b987a5
2 changed files with 30 additions and 22 deletions

View file

@ -1,3 +1,8 @@
2005-10-31 Andrew Stubbs <andrew.stubbs@st.com>
* tui/tui-command.c (tui_dispatch_ctrl_char): Test output of
getenv() before using it.
2005-10-29 Mark Kettenis <kettenis@gnu.org> 2005-10-29 Mark Kettenis <kettenis@gnu.org>
* hppa-tdep.h (HPPA_INSN_SIZE): New define. * hppa-tdep.h (HPPA_INSN_SIZE): New define.

View file

@ -68,33 +68,36 @@ tui_dispatch_ctrl_char (unsigned int ch)
** Seems like a bug in the curses library? ** Seems like a bug in the curses library?
*/ */
term = (char *) getenv ("TERM"); term = (char *) getenv ("TERM");
for (i = 0; (term && term[i]); i++) if (term)
term[i] = toupper (term[i]);
if ((strcmp (term, "XTERM") == 0) && key_is_start_sequence (ch))
{ {
unsigned int page_ch = 0; for (i = 0; term[i]; i++)
unsigned int tmp_char; term[i] = toupper (term[i]);
if ((strcmp (term, "XTERM") == 0) && key_is_start_sequence (ch))
tmp_char = 0;
while (!key_is_end_sequence (tmp_char))
{ {
tmp_char = (int) wgetch (w); unsigned int page_ch = 0;
if (tmp_char == ERR) unsigned int tmp_char;
tmp_char = 0;
while (!key_is_end_sequence (tmp_char))
{ {
return ch; tmp_char = (int) wgetch (w);
} if (tmp_char == ERR)
if (!tmp_char) {
break; return ch;
if (tmp_char == 53) }
page_ch = KEY_PPAGE; if (!tmp_char)
else if (tmp_char == 54) break;
page_ch = KEY_NPAGE; if (tmp_char == 53)
else page_ch = KEY_PPAGE;
{ else if (tmp_char == 54)
return 0; page_ch = KEY_NPAGE;
else
{
return 0;
}
} }
ch_copy = page_ch;
} }
ch_copy = page_ch;
} }
switch (ch_copy) switch (ch_copy)