* config/pa/tm-hppa.h: Define lots register offsets needed by
[deliverable/binutils-gdb.git] / gdb / serial.c
index e5ccf1d18e1fc38ad8dc10938f3df94b1e0a921c..631f0f3441e3aa18b92887e279668e18a1fb3b02 100644 (file)
@@ -52,13 +52,15 @@ serial_add_interface(optable)
 /* Open up a device or a network socket, depending upon the syntax of NAME. */
 
 serial_t
-serial_open(name)
+serial_open (name)
      const char *name;
 {
   serial_t scb;
   struct serial_ops *ops;
 
-  if (strchr (name, ':'))
+  if (strcmp (name, "pc") == 0)
+    ops = serial_interface_lookup ("pc");
+  else if (strchr (name, ':'))
     ops = serial_interface_lookup ("tcp");
   else
     ops = serial_interface_lookup ("hardwire");
@@ -116,12 +118,32 @@ serial_close(scb)
 {
   last_serial_opened = NULL;
 
-  scb->ops->close(scb);
+/* This is bogus.  It's not our fault if you pass us a bad scb...!  Rob, you
+   should fix your code instead.  */
+
+  if (!scb)
+    return;
 
+  scb->ops->close(scb);
   free(scb);
 }
 
 #if 0
+/*
+The connect command is #if 0 because I hadn't thought of an elegant
+way to wait for I/O on two serial_t's simultaneously.  Two solutions
+came to mind:
+
+       1) Fork, and have have one fork handle the to user direction,
+          and have the other hand the to target direction.  This
+          obviously won't cut it for MSDOS.
+
+       2) Use something like select.  This assumes that stdin and
+          the target side can both be waited on via the same
+          mechanism.  This may not be true for DOS, if GDB is
+          talking to the target via a TCP socket.
+-grossman, 8 Jun 93
+*/
 
 /* Connect the user directly to the remote system.  This command acts just like
    the 'cu' or 'tip' command.  Use <CR>~. or <CR>~^D to break out.  */
@@ -132,7 +154,7 @@ static void
 cleanup_tty(ttystate)
      serial_ttystate ttystate;
 {
-  printf ("\r\n[Exiting connect mode]\r\n");
+  printf_unfiltered ("\r\n[Exiting connect mode]\r\n");
   SERIAL_SET_TTY_STATE (tty_desc, ttystate);
   free (ttystate);
   SERIAL_CLOSE (tty_desc);
@@ -151,9 +173,9 @@ connect_command (args, fromtty)
   dont_repeat();
 
   if (args)
-    fprintf(stderr, "This command takes no args.  They have been ignored.\n");
+    fprintf_unfiltered(gdb_stderr, "This command takes no args.  They have been ignored.\n");
        
-  printf("[Entering connect mode.  Use ~. or ~^D to escape]\n");
+  printf_unfiltered("[Entering connect mode.  Use ~. or ~^D to escape]\n");
 
   tty_desc = SERIAL_FDOPEN (0);
   port_desc = last_serial_opened;
@@ -230,12 +252,14 @@ connect_command (args, fromtty)
        }
     }
 }
+#endif /* 0 */
 
 void
 _initialize_serial ()
 {
+#if 0
   add_com ("connect", class_obscure, connect_command,
           "Connect the terminal directly up to the command monitor.\n\
 Use <CR>~. or <CR>~^D to break out.");
-}
 #endif /* 0 */
+}
This page took 0.02406 seconds and 4 git commands to generate.