Change the stream argument to _filtered to GDB_FILE *.
[deliverable/binutils-gdb.git] / gdb / remote-utils.c
index 0b570fda78bfa13a192f20dbe882410477dfd4e8..af4d4317c21927a7a43daf923bc32abca6805d0d 100644 (file)
@@ -52,8 +52,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #include "remote-utils.h"
 
 struct _sr_settings sr_settings = {
-  0, /* debug */
-  9600,        /* baud */
   4, /* timeout:
        remote-hms.c had 2
        remote-bug.c had "with a timeout of 2, we time out waiting for
@@ -78,7 +76,7 @@ usage(proto, junk)
      char *junk;
 {
   if (junk != NULL)
-    fprintf(stderr, "Unrecognized arguments: `%s'.\n", junk);
+    fprintf_unfiltered(gdb_stderr, "Unrecognized arguments: `%s'.\n", junk);
 
   /* FIXME-now: service@host? */
 
@@ -183,6 +181,10 @@ gr_open(args, from_tty, gr)
 
   SERIAL_RAW (sr_get_desc());
 
+  /* If there is something sitting in the buffer we might take it as a
+     response to a command, which would be bad.  */
+  SERIAL_FLUSH_INPUT (sr_get_desc ());
+
   /* default retries */
   if (sr_get_retries() == 0)
     sr_set_retries(1);
@@ -215,7 +217,7 @@ sr_readchar ()
     error ("Timeout reading from remote system.");
 
   if (sr_get_debug() > 0)
-    printf ("%c", buf);
+    printf_unfiltered ("%c", buf);
 
   return buf & 0x7f;
 }
@@ -230,9 +232,9 @@ sr_pollchar()
     buf = 0;
   if (sr_get_debug() > 0)
     if (buf)
-      printf ("%c", buf);
+      printf_unfiltered ("%c", buf);
     else
-      printf ("<empty character poll>");
+      printf_unfiltered ("<empty character poll>");
 
   return buf & 0x7f;
 }
@@ -274,7 +276,7 @@ sr_write (a, l)
 
   if (sr_get_debug() > 0)
     for (i = 0; i < l; i++)
-      printf ("%c", a[i]);
+      printf_unfiltered ("%c", a[i]);
 
   return;
 }
@@ -535,7 +537,7 @@ gr_multi_scan (list, passthrough)
   swallowed_p = swallowed = alloca(max_length << 1);
 
   /* and a list of pointers to current scan points. */
-  plist = alloca(string_count * sizeof(*plist));
+  plist = (char **) alloca (string_count * sizeof(*plist));
 
   /* and initialize */
   for (i = 0; i < string_count; ++i)
@@ -571,16 +573,18 @@ gr_multi_scan (list, passthrough)
          if (passthrough)
            {
              for (p = swallowed; p < swallowed_p; ++p)
-               putc (*p, stdout);
+               putc_unfiltered (*p, gdb_stdout);
 
-             putc (ch, stdout);
+             putc_unfiltered (ch, gdb_stdout);
            }
 
          swallowed_p = swallowed;
        }
     }
-
+#if 0
+  /* Never reached.  */
   return(-1);
+#endif
 }
 
 /* Get ready to modify the registers array.  On machines which store
@@ -619,21 +623,6 @@ gr_store_word (addr, word)
 void
 _initialize_sr_support ()
 {
-  add_show_from_set (add_set_cmd ("remotedebug", no_class,
-                                 var_zinteger, (char *)&sr_settings.debug,
-                                 "Set debugging of remote serial I/O.\n\
-When non-zero, each packet sent or received with the remote target\n\
-is displayed.  Higher numbers produce more debugging.", &setlist),
-                    &showlist);
-
-/* FIXME-now: if target is open when baud changes... */
-  add_show_from_set (add_set_cmd ("remotebaud", no_class,
-                                 var_zinteger, (char *)&sr_settings.baud_rate,
-                                 "Set baud rate for remote serial I/O.\n\
-This value is used to set the speed of the serial port when debugging\n\
-using remote targets.", &setlist),
-                    &showlist);
-
 /* FIXME-now: if target is open... */
   add_show_from_set (add_set_cmd ("remotedevice", no_class,
                                  var_filename, (char *)&sr_settings.device,
This page took 0.156776 seconds and 4 git commands to generate.