2003-08-07 Michal Ludvig <mludvig@suse.cz>
[deliverable/binutils-gdb.git] / gdb / top.c
index dcffb0514361ff3c5ee56621a5c3de0ad8179a5d..e4f9642fcf4314927d9b0f091975dc3d7992b12f 100644 (file)
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -171,6 +171,11 @@ int target_executing = 0;
 /* Level of control structure.  */
 static int control_level;
 
+/* Sbrk location on entry to main.  Used for statistics only.  */
+#ifdef HAVE_SBRK
+char *lim_at_start;
+#endif
+
 /* Signal to catch ^Z typed while reading a command: SIGTSTP or SIGCONT.  */
 
 #ifndef STOP_SIGNAL
@@ -485,7 +490,7 @@ struct catch_errors_args
   void *func_args;
 };
 
-int
+static int
 do_catch_errors (struct ui_out *uiout, void *data)
 {
   struct catch_errors_args *args = data;
@@ -782,10 +787,8 @@ command_loop (void)
       if (display_space)
        {
 #ifdef HAVE_SBRK
-         extern char **environ;
          char *lim = (char *) sbrk (0);
-
-         space_at_cmd_start = (long) (lim - (char *) &environ);
+         space_at_cmd_start = lim - lim_at_start;
 #endif
        }
 
@@ -805,9 +808,8 @@ command_loop (void)
       if (display_space)
        {
 #ifdef HAVE_SBRK
-         extern char **environ;
          char *lim = (char *) sbrk (0);
-         long space_now = lim - (char *) &environ;
+         long space_now = lim - lim_at_start;
          long space_diff = space_now - space_at_cmd_start;
 
          printf_unfiltered ("Space used: %ld (%c%ld for this command)\n",
@@ -1059,7 +1061,7 @@ static int operate_saved_history = -1;
 
 /* This is put on the appropriate hook and helps operate-and-get-next
    do its work.  */
-void
+static void
 gdb_rl_operate_and_get_next_completion (void)
 {
   int delta = where_history () - operate_saved_history;
@@ -1199,9 +1201,9 @@ command_line_input (char *prompt_arg, int repeat, char *annotation_suffix)
 
       if (annotation_level > 1 && instream == stdin)
        {
-         printf_unfiltered ("\n\032\032pre-");
-         printf_unfiltered (annotation_suffix);
-         printf_unfiltered ("\n");
+         puts_unfiltered ("\n\032\032pre-");
+         puts_unfiltered (annotation_suffix);
+         puts_unfiltered ("\n");
        }
 
       /* Don't use fancy stuff if not talking to stdin.  */
@@ -1220,9 +1222,9 @@ command_line_input (char *prompt_arg, int repeat, char *annotation_suffix)
 
       if (annotation_level > 1 && instream == stdin)
        {
-         printf_unfiltered ("\n\032\032post-");
-         printf_unfiltered (annotation_suffix);
-         printf_unfiltered ("\n");
+         puts_unfiltered ("\n\032\032post-");
+         puts_unfiltered (annotation_suffix);
+         puts_unfiltered ("\n");
        }
 
       if (!rl || rl == (char *) EOF)
@@ -1684,7 +1686,7 @@ quit_confirm (void)
       else
        s = "The program is running.  Exit anyway? ";
 
-      if (!query (s))
+      if (!query ("%s", s))
        return 0;
     }
 
@@ -2124,19 +2126,4 @@ gdb_init (char *argv0)
      it wants GDB to revert to the CLI, it should clear init_ui_hook. */
   if (init_ui_hook)
     init_ui_hook (argv0);
-
-  /* Install the default UI */
-  if (!init_ui_hook)
-    {
-      uiout = cli_out_new (gdb_stdout);
-
-      /* All the interpreters should have had a look at things by now.
-        Initialize the selected interpreter. */
-      if (interpreter_p)
-       {
-         fprintf_unfiltered (gdb_stderr, "Interpreter `%s' unrecognized.\n",
-                             interpreter_p);
-         exit (1);
-       }
-    }
 }
This page took 0.025204 seconds and 4 git commands to generate.