* strerror.c: Revert last change. Declare static sys_nerr
[deliverable/binutils-gdb.git] / gdb / top.c
index 7ac5dd8f6923ba64ced6f47f77af20d14473da2b..baeaa9339213b043c6e3a08631302cc479845f4c 100644 (file)
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -640,8 +640,8 @@ do_chdir_cleanup (void *old_dir)
 void
 execute_command (char *p, int from_tty)
 {
-  register struct cmd_list_element *c;
-  register enum language flang;
+  struct cmd_list_element *c;
+  enum language flang;
   static int warned = 0;
   char *line;
   
@@ -1135,7 +1135,7 @@ command_line_input (char *prompt_arg, int repeat, char *annotation_suffix)
 {
   static char *linebuffer = 0;
   static unsigned linelength = 0;
-  register char *p;
+  char *p;
   char *p1;
   char *rl;
   char *local_prompt = prompt_arg;
@@ -1439,28 +1439,25 @@ quit_confirm (void)
   return 1;
 }
 
-/* Quit without asking for confirmation.  */
+/* Helper routine for quit_force that requires error handling.  */
 
-void
-quit_force (char *args, int from_tty)
+struct qt_args
 {
-  int exit_code = 0;
-
-  /* An optional expression may be used to cause gdb to terminate with the 
-     value of that expression. */
-  if (args)
-    {
-      struct value *val = parse_and_eval (args);
+  char *args;
+  int from_tty;
+};
 
-      exit_code = (int) value_as_long (val);
-    }
+static int
+quit_target (void *arg)
+{
+  struct qt_args *qt = (struct qt_args *)arg;
 
   if (! ptid_equal (inferior_ptid, null_ptid) && target_has_execution)
     {
       if (attach_flag)
-       target_detach (args, from_tty);
+        target_detach (qt->args, qt->from_tty);
       else
-       target_kill ();
+        target_kill ();
     }
 
   /* UDI wants this, to kill the TIP.  */
@@ -1472,6 +1469,33 @@ quit_force (char *args, int from_tty)
 
   do_final_cleanups (ALL_CLEANUPS);    /* Do any final cleanups before exiting */
 
+  return 0;
+}
+
+/* Quit without asking for confirmation.  */
+
+void
+quit_force (char *args, int from_tty)
+{
+  int exit_code = 0;
+  struct qt_args qt;
+
+  /* An optional expression may be used to cause gdb to terminate with the 
+     value of that expression. */
+  if (args)
+    {
+      struct value *val = parse_and_eval (args);
+
+      exit_code = (int) value_as_long (val);
+    }
+
+  qt.args = args;
+  qt.from_tty = from_tty;
+
+  /* We want to handle any quit errors and exit regardless.  */
+  catch_errors (quit_target, &qt,
+               "Quitting: ", RETURN_MASK_ALL);
+
   exit (exit_code);
 }
 
@@ -1484,7 +1508,6 @@ input_from_terminal_p (void)
   return gdb_has_a_terminal () && (instream == stdin) & caution;
 }
 \f
-/* ARGSUSED */
 static void
 dont_repeat_command (char *ignored, int from_tty)
 {
@@ -1570,7 +1593,6 @@ show_commands (char *args, int from_tty)
 }
 
 /* Called by do_setshow_command.  */
-/* ARGSUSED */
 static void
 set_history_size_command (char *args, int from_tty, struct cmd_list_element *c)
 {
@@ -1585,7 +1607,6 @@ set_history_size_command (char *args, int from_tty, struct cmd_list_element *c)
     }
 }
 
-/* ARGSUSED */
 void
 set_history (char *args, int from_tty)
 {
@@ -1593,7 +1614,6 @@ set_history (char *args, int from_tty)
   help_list (sethistlist, "set history ", -1, gdb_stdout);
 }
 
-/* ARGSUSED */
 void
 show_history (char *args, int from_tty)
 {
@@ -1603,7 +1623,6 @@ show_history (char *args, int from_tty)
 int info_verbose = 0;          /* Default verbose msgs off */
 
 /* Called by do_setshow_command.  An elaborate joke.  */
-/* ARGSUSED */
 void
 set_verbose (char *args, int from_tty, struct cmd_list_element *c)
 {
This page took 0.028182 seconds and 4 git commands to generate.