* config/i386/tm-cygwin.h: include tm-i386.h instead of tm-i386v.h. This fixes
[binutils-gdb.git] / gdb / ser-tcp.c
index d7eb9cbd7df2d01dddb55a46a98809dfb7ac4da4..9a868e8df7293b6e7a4e6fc51e786faf4720608d 100644 (file)
 #include <arpa/inet.h>
 #include <netdb.h>
 #include <sys/socket.h>
-#ifndef __CYGWIN__
 #include <netinet/tcp.h>
-#endif
 
 #include <signal.h>
 #include "gdb_string.h"
 
-static int tcp_open (serial_t scb, const char *name);
-static void tcp_close (serial_t scb);
+static int tcp_open (struct serial *scb, const char *name);
+static void tcp_close (struct serial *scb);
 
 void _initialize_ser_tcp (void);
 
 /* Open up a raw tcp socket */
 
 static int
-tcp_open (serial_t scb, const char *name)
+tcp_open (struct serial *scb, const char *name)
 {
   char *port_str;
   int port;
@@ -65,6 +63,9 @@ tcp_open (serial_t scb, const char *name)
   hostname[tmp] = '\000';      /* Tie off host name */
   port = atoi (port_str + 1);
 
+  if (!hostname[0])
+    strcpy (hostname, "localhost");
+
   hostent = gethostbyname (hostname);
 
   if (!hostent)
@@ -124,7 +125,7 @@ tcp_open (serial_t scb, const char *name)
 }
 
 static void
-tcp_close (serial_t scb)
+tcp_close (struct serial *scb)
 {
   if (scb->fd < 0)
     return;