aboutsummaryrefslogtreecommitdiff
path: root/gdb/top.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/top.c')
-rw-r--r--gdb/top.c36
1 files changed, 19 insertions, 17 deletions
diff --git a/gdb/top.c b/gdb/top.c
index 3842f0c..733580f 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -123,13 +123,6 @@ show_confirm (struct ui_file *file, int from_tty,
value);
}
-/* stdio stream that command input is being read from. Set to stdin
- normally. Set by source_command to the file we are sourcing. Set
- to NULL if we are executing a user-defined command or interacting
- via a GUI. */
-
-FILE *instream;
-
/* Flag to indicate whether a user defined command is currently running. */
int in_user_command;
@@ -286,23 +279,26 @@ quit_cover (void)
void
do_restore_instream_cleanup (void *stream)
{
+ struct ui *ui = current_ui;
+
/* Restore the previous input stream. */
- instream = (FILE *) stream;
+ ui->instream = (FILE *) stream;
}
/* Read commands from STREAM. */
void
read_command_file (FILE *stream)
{
+ struct ui *ui = current_ui;
struct cleanup *cleanups;
- cleanups = make_cleanup (do_restore_instream_cleanup, instream);
- instream = stream;
+ cleanups = make_cleanup (do_restore_instream_cleanup, ui->instream);
+ ui->instream = stream;
/* Read commands from `instream' and execute them until end of file
or error reading instream. */
- while (instream != NULL && !feof (instream))
+ while (ui->instream != NULL && !feof (ui->instream))
{
char *command;
@@ -568,13 +564,15 @@ static int suppress_dont_repeat = 0;
void
dont_repeat (void)
{
+ struct ui *ui = current_ui;
+
if (suppress_dont_repeat || server_command)
return;
/* If we aren't reading from standard input, we are saving the last
thing read from stdin in line and don't want to delete it. Null
lines won't repeat here in any case. */
- if (instream == stdin)
+ if (ui->instream == stdin)
*saved_command_line = 0;
}
@@ -603,9 +601,10 @@ static char *
gdb_readline_no_editing (const char *prompt)
{
struct buffer line_buffer;
+ struct ui *ui = current_ui;
/* Read from stdin if we are executing a user defined command. This
is the right thing for prompt_for_continue, at least. */
- FILE *stream = instream != NULL ? instream : stdin;
+ FILE *stream = ui->instream != NULL ? ui->instream : stdin;
int fd = fileno (stream);
buffer_init (&line_buffer);
@@ -1047,6 +1046,7 @@ command_line_input (const char *prompt_arg, int repeat, char *annotation_suffix)
{
static struct buffer cmd_line_buffer;
static int cmd_line_buffer_initialized;
+ struct ui *ui = current_ui;
const char *prompt = prompt_arg;
char *cmd;
@@ -1054,7 +1054,7 @@ command_line_input (const char *prompt_arg, int repeat, char *annotation_suffix)
if (annotation_suffix == NULL)
annotation_suffix = "";
- if (annotation_level > 1 && instream == stdin)
+ if (annotation_level > 1 && ui->instream == stdin)
{
char *local_prompt;
@@ -1100,7 +1100,7 @@ command_line_input (const char *prompt_arg, int repeat, char *annotation_suffix)
if (source_file_name != NULL)
++source_line_number;
- if (annotation_level > 1 && instream == stdin)
+ if (annotation_level > 1 && ui->instream == stdin)
{
puts_unfiltered ("\n\032\032pre-");
puts_unfiltered (annotation_suffix);
@@ -1511,16 +1511,18 @@ quit_force (char *args, int from_tty)
int
input_from_terminal_p (void)
{
+ struct ui *ui = current_ui;
+
if (batch_flag)
return 0;
- if (gdb_has_a_terminal () && instream == stdin)
+ if (gdb_has_a_terminal () && ui->instream == stdin)
return 1;
/* If INSTREAM is unset, and we are not in a user command, we
must be in Insight. That's like having a terminal, for our
purposes. */
- if (instream == NULL && !in_user_command)
+ if (ui->instream == NULL && !in_user_command)
return 1;
return 0;