int job_control;
-/* Nonzero means quit immediately if Control-C is typed now, rather
- than waiting until QUIT is executed. Be careful in setting this;
- code which executes with immediate_quit set has to be very careful
- about being able to deal with being interrupted at any time. It is
- almost always better to use QUIT; the only exception I can think of
- is being able to quit out of a system call (using EINTR loses if
- the SIGINT happens between the previous QUIT and the system call).
- To immediately quit in the case in which a SIGINT happens between
- the previous QUIT and setting immediate_quit (desirable anytime we
- expect to block), call QUIT after setting immediate_quit. */
-
-int immediate_quit;
-
/* Nonzero means that strings with character values >0x7F should be printed
as octal escapes. Zero means just print the value (e.g. it's an
international character, and the terminal or window can cope.) */
void
quit (void)
{
+ struct ui *ui = current_ui;
+
if (sync_quit_force_run)
{
sync_quit_force_run = 0;
- quit_force (NULL, stdin == instream);
+ quit_force (NULL, 0);
}
#ifdef __MSDOS__
void
maybe_quit (void)
{
- if (check_quit_flag () || sync_quit_force_run)
+ if (sync_quit_force_run)
quit ();
+
+ quit_handler ();
+
if (deprecated_interactive_hook)
deprecated_interactive_hook ();
- target_check_pending_interrupt ();
}
\f
if (!confirm || server_command)
return def_value;
+ old_chain = make_cleanup_restore_target_terminal ();
+
/* If input isn't coming from the user directly, just say what
question we're asking, and then answer the default automatically. This
way, important error messages don't get lost when talking to GDB
over a pipe. */
- if (! input_from_terminal_p ())
+ if (current_ui->instream != current_ui->stdin_stream
+ || !input_interactive_p (current_ui))
{
+ target_terminal_ours_for_output ();
wrap_here ("");
vfprintf_filtered (gdb_stdout, ctlstr, args);
y_string, n_string, def_answer);
gdb_flush (gdb_stdout);
+ do_cleanups (old_chain);
return def_value;
}
if (deprecated_query_hook)
{
- return deprecated_query_hook (ctlstr, args);
- }
+ int res;
- old_chain = make_cleanup (null_cleanup, NULL);
+ res = deprecated_query_hook (ctlstr, args);
+ do_cleanups (old_chain);
+ return res;
+ }
/* Format the question outside of the loop, to avoid reusing args. */
question = xstrvprintf (ctlstr, args);
/* Used for calculating time spend waiting for user. */
gettimeofday (&prompt_started, NULL);
+ /* We'll need to handle input. */
+ target_terminal_ours ();
+ make_cleanup_override_quit_handler (default_quit_handler);
+
while (1)
{
char *response, answer;
reinitialize_more_filter ();
/* We'll need to handle input. */
+ make_cleanup_restore_target_terminal ();
target_terminal_ours ();
+ make_cleanup_override_quit_handler (default_quit_handler);
/* Call gdb_readline_wrapper, not readline, in order to keep an
event loop running. */