2008-11-12 Tristan Gingold <gingold@adacore.com>
[binutils-gdb.git] / gdb / ser-mingw.c
index d57ea7f7fc8e8aeb7dd0667b5138d64c2b9e7486..99612dfc6f8565fdc1b6d9dea17fae0ee0f5bab2 100644 (file)
@@ -1,6 +1,6 @@
 /* Serial interface for local (hardwired) serial ports on Windows systems
 
-   Copyright (C) 2006, 2007 Free Software Foundation, Inc.
+   Copyright (C) 2006, 2007, 2008 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -32,6 +32,8 @@
 #include "gdb_assert.h"
 #include "gdb_string.h"
 
+#include "command.h"
+
 void _initialize_ser_windows (void);
 
 struct ser_windows_state
@@ -51,13 +53,6 @@ ser_windows_open (struct serial *scb, const char *name)
   struct ser_windows_state *state;
   COMMTIMEOUTS timeouts;
 
-  /* Only allow COM ports.  */
-  if (strncmp (name, "COM", 3) != 0)
-    {
-      errno = ENOENT;
-      return -1;
-    }
-
   h = CreateFile (name, GENERIC_READ | GENERIC_WRITE, 0, NULL,
                  OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL);
   if (h == INVALID_HANDLE_VALUE)
@@ -824,13 +819,18 @@ pipe_windows_open (struct serial *scb, const char *name)
 {
   struct pipe_state *ps;
   FILE *pex_stderr;
+  char **argv;
+  struct cleanup *back_to;
+
+  if (name == NULL)
+    error_no_arg (_("child command"));
+
+  argv = gdb_buildargv (name);
+  back_to = make_cleanup_freeargv (argv);
 
-  char **argv = buildargv (name);
-  struct cleanup *back_to = make_cleanup_freeargv (argv);
   if (! argv[0] || argv[0][0] == '\0')
     error ("missing child command");
 
-
   ps = make_pipe_state ();
   make_cleanup (cleanup_pipe_state, ps);
 
@@ -1263,7 +1263,7 @@ _initialize_ser_windows (void)
   ops->write = ser_base_write;
   ops->flush_output = ser_base_flush_output;
   ops->flush_input = ser_base_flush_input;
-  ops->send_break = ser_base_send_break;
+  ops->send_break = ser_tcp_send_break;
   ops->go_raw = ser_base_raw;
   ops->get_tty_state = ser_base_get_tty_state;
   ops->set_tty_state = ser_base_set_tty_state;