+2002-11-08  Jeff Johnston  <jjohnstn@redhat.com>
+
+       * mi-main.c (mi_command_loop): Initialize raw_stdout and gdb_stdout 
+       only if mi version is <= 1.
+       (mi_init_ui): Initialize raw_stdout and gdb_stdout if mi version 
+       is > 1 so startup message is treated as console output.  This is 
+       part of fix for PR gdb/604.
+
 2002-11-06  Jeff Johnston  <jjohnstn@redhat.com>
 
        * mi-cmd-var.c (mi_cmd_var_create): Change the function used to 
 
 static void
 mi_command_loop (int mi_version)
 {
-  /* HACK: Force stdout/stderr to point at the console.  This avoids
-     any potential side effects caused by legacy code that is still
-     using the TUI / fputs_unfiltered_hook */
-  raw_stdout = stdio_fileopen (stdout);
-  /* Route normal output through the MIx */
-  gdb_stdout = mi_console_file_new (raw_stdout, "~");
+  if (mi_version <= 1)
+    {
+      /* HACK: Force stdout/stderr to point at the console.  This avoids
+         any potential side effects caused by legacy code that is still
+         using the TUI / fputs_unfiltered_hook */
+      raw_stdout = stdio_fileopen (stdout);
+      /* Route normal output through the MIx */
+      gdb_stdout = mi_console_file_new (raw_stdout, "~");
+    }
+
   /* Route error and log output through the MI */
   gdb_stderr = mi_console_file_new (raw_stdout, "&");
   gdb_stdlog = gdb_stderr;
 static void
 mi_init_ui (char *arg0)
 {
-  /* Eventually this will contain code that takes control of the
-     console. */
+  if (strlen (interpreter_p) <= 2 ||
+      interpreter_p[2] > '1')
+    {
+      /* HACK: Force stdout/stderr to point at the console.  This avoids
+         any potential side effects caused by legacy code that is still
+         using the TUI / fputs_unfiltered_hook */
+      raw_stdout = stdio_fileopen (stdout);
+      /* Route normal output through the MIx */
+      gdb_stdout = mi_console_file_new (raw_stdout, "~");
+    }
 }
 
 void