aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorAndrew Stubbs <andrew.stubbs@st.com>2005-10-31 19:11:35 +0000
committerAndrew Stubbs <andrew.stubbs@st.com>2005-10-31 19:11:35 +0000
commitbbe6b987a5c7a3fa8d1f25f03a08a6463441b8ff (patch)
treead60a4cac9a819279c65555ed2959a1da17bcc9c /gdb
parentfb10537e39d4cdf8e69a289ef96872c916ba663c (diff)
downloadgdb-bbe6b987a5c7a3fa8d1f25f03a08a6463441b8ff.zip
gdb-bbe6b987a5c7a3fa8d1f25f03a08a6463441b8ff.tar.gz
gdb-bbe6b987a5c7a3fa8d1f25f03a08a6463441b8ff.tar.bz2
2005-10-31 Andrew Stubbs <andrew.stubbs@st.com>
* tui/tui-command.c (tui_dispatch_ctrl_char): Test output of getenv() before using it.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/tui/tui-command.c47
2 files changed, 30 insertions, 22 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index de5d48c..87e270f 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -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>
* hppa-tdep.h (HPPA_INSN_SIZE): New define.
diff --git a/gdb/tui/tui-command.c b/gdb/tui/tui-command.c
index 399ef85..7f3fc75 100644
--- a/gdb/tui/tui-command.c
+++ b/gdb/tui/tui-command.c
@@ -68,33 +68,36 @@ tui_dispatch_ctrl_char (unsigned int ch)
** Seems like a bug in the curses library?
*/
term = (char *) getenv ("TERM");
- for (i = 0; (term && term[i]); i++)
- term[i] = toupper (term[i]);
- if ((strcmp (term, "XTERM") == 0) && key_is_start_sequence (ch))
+ if (term)
{
- unsigned int page_ch = 0;
- unsigned int tmp_char;
-
- tmp_char = 0;
- while (!key_is_end_sequence (tmp_char))
+ for (i = 0; term[i]; i++)
+ term[i] = toupper (term[i]);
+ if ((strcmp (term, "XTERM") == 0) && key_is_start_sequence (ch))
{
- tmp_char = (int) wgetch (w);
- if (tmp_char == ERR)
- {
- return ch;
- }
- if (!tmp_char)
- break;
- if (tmp_char == 53)
- page_ch = KEY_PPAGE;
- else if (tmp_char == 54)
- page_ch = KEY_NPAGE;
- else
+ unsigned int page_ch = 0;
+ unsigned int tmp_char;
+
+ tmp_char = 0;
+ while (!key_is_end_sequence (tmp_char))
{
- return 0;
+ tmp_char = (int) wgetch (w);
+ if (tmp_char == ERR)
+ {
+ return ch;
+ }
+ if (!tmp_char)
+ break;
+ if (tmp_char == 53)
+ page_ch = KEY_PPAGE;
+ else if (tmp_char == 54)
+ page_ch = KEY_NPAGE;
+ else
+ {
+ return 0;
+ }
}
+ ch_copy = page_ch;
}
- ch_copy = page_ch;
}
switch (ch_copy)