/* TUI support I/O functions.
- Copyright (C) 1998-2004, 2007-2012 Free Software Foundation, Inc.
+ Copyright (C) 1998-2014 Free Software Foundation, Inc.
Contributed by Hewlett-Packard Company.
#include <fcntl.h>
#include <signal.h>
#include <stdio.h>
+#include "filestuff.h"
#include "gdb_curses.h"
struct ui_out *tui_old_uiout;
/* Readline previous hooks. */
-static Function *tui_old_rl_getc_function;
-static VFunction *tui_old_rl_redisplay_function;
-static VFunction *tui_old_rl_prep_terminal;
-static VFunction *tui_old_rl_deprep_terminal;
+static rl_getc_func_t *tui_old_rl_getc_function;
+static rl_voidfunc_t *tui_old_rl_redisplay_function;
+static rl_vintfunc_t *tui_old_rl_prep_terminal;
+static rl_voidfunc_t *tui_old_rl_deprep_terminal;
static int tui_old_rl_echoing_p;
/* Readline output stream.
(we can't use gdb_prompt() due to secondary prompts and can't use
rl_prompt because it points to an alloca buffer). */
xfree (tui_rl_saved_prompt);
- tui_rl_saved_prompt = xstrdup (rl_prompt);
+ tui_rl_saved_prompt = rl_prompt != NULL ? xstrdup (rl_prompt) : NULL;
}
/* Readline callback to restore the terminal. It is called once each
tui_stderr = tui_fileopen (stderr);
tui_out = tui_out_new (tui_stdout);
- /* Create the default UI. It is not created because we installed a
- deprecated_init_ui_hook. */
+ /* Create the default UI. */
tui_old_uiout = cli_out_new (gdb_stdout);
#ifdef TUI_USE_PIPE_FOR_READLINE
/* Temporary solution for readline writing to stdout: redirect
readline output in a pipe, read that pipe and output the content
in the curses command window. */
- if (pipe (tui_readline_pipe) != 0)
+ if (gdb_pipe_cloexec (tui_readline_pipe) != 0)
{
fprintf_unfiltered (gdb_stderr, "Cannot create pipe for readline");
exit (1);