]> andersk Git - moira.git/blobdiff - gdb/gdb_conn.c
fix RCS Id strings
[moira.git] / gdb / gdb_conn.c
index 81aaa319300282e09307bafed29d4d6e022796b4..ba5b5c7a9d0f2d8696484b1e74f14e587b0b1e6e 100644 (file)
@@ -5,7 +5,7 @@
 
 #ifndef lint
 static char *rcsid_gdb_conn_c = "$Header$";
-#endif lint
+#endif
 
 /************************************************************************
  *     
@@ -27,7 +27,8 @@ static char *rcsid_gdb_conn_c = "$Header$";
 
 #include <mit-copyright.h>
 #include <stdio.h>
-#include <strings.h>
+#include <stdlib.h>
+#include <string.h>
 #include "gdb.h"
 #include <sys/types.h>
 #include <sys/uio.h>
@@ -39,30 +40,30 @@ static char *rcsid_gdb_conn_c = "$Header$";
 #ifdef SOLARIS
 #include <sys/filio.h>
 #endif /* SOLARIS */
+#ifdef POSIX
+#include <unistd.h>
+#endif
 
 extern int errno;
-#ifdef vax
-extern u_short htons();                        /* ?? All versions?  */
-#endif vax
 
 CONNECTION gdb_allocate_connection();
 
-/************************************************************************/
-/*     
-/*                     start_peer_connection (start_peer_connection)
-/*     
-/*     Starts a connection to another process which itself will be 
-/*     issuing a start_peer_connection to us.  Current implementation
-/*     builds at most one stream, with the risk of a hang if 
-/*     the attempts to connect cross in the night.  This is a bug,
-/*     but this level of support is acceptable for casual debugging
-/*     of applications, and perhaps for some production use in
-/*     controlled settings.  I think the only other way to do it 
-/*     is to risk building two streams in parallel, possibly tearing
-/*     one down when the duplication is discovered.  Seems complicated
-/*     and messy.
-/*     
-/************************************************************************/
+/************************************************************************
+ *     
+ *                     start_peer_connection (start_peer_connection)
+ *     
+ *     Starts a connection to another process which itself will be 
+ *     issuing a start_peer_connection to us.  Current implementation
+ *     builds at most one stream, with the risk of a hang if 
+ *     the attempts to connect cross in the night.  This is a bug,
+ *     but this level of support is acceptable for casual debugging
+ *     of applications, and perhaps for some production use in
+ *     controlled settings.  I think the only other way to do it 
+ *     is to risk building two streams in parallel, possibly tearing
+ *     one down when the duplication is discovered.  Seems complicated
+ *     and messy.
+ *     
+ ************************************************************************/
 
 CONNECTION
 start_peer_connection(id)
@@ -123,7 +124,8 @@ char *id;                                   /* null terminated string */
        } else
                return NULL;
 }
-\f
+
+
 /************************************************************************/
 /*     
 /*                             g_make_con
@@ -154,7 +156,8 @@ g_make_con()
 
 }
 
-\f/************************************************************************/
+
+/************************************************************************/
 /*     
 /*                             g_null_con
 /*     
@@ -209,7 +212,7 @@ CONNECTION con;
 
 }
 
-\f
+
 /************************************************************************/
 /*     
 /*                     gdb_allocate_connection
@@ -250,7 +253,8 @@ gdb_allocate_connection()
        return &gdb_cons[i];                    /* return new highest con */
                                                /* ever used*/       
 }
-\f
+
+
 /************************************************************************/
 /*     
 /*                     g_try_connecting
@@ -271,7 +275,7 @@ char *id;
 {
        int peer;                               /* socket for talking to
                                                   peer */
-       int on = 1;                             /* flag for ioctl */
+       char on = 1;                            /* flag for ioctl */
        struct sockaddr_in target;              /* build the peer address */
                                                /* here */
        struct hostent *peer_host;              /* host where peer is */
@@ -292,7 +296,7 @@ char *id;
        /*      
        /*----------------------------------------------------------*/
 
-       bzero((char *)&target, sizeof(target));
+       memset((char *)&target, 0, sizeof(target));
        g_parse_target(id, &peer_host, &target.sin_port);
        if (peer_host == NULL) {
                fprintf(gdb_log,"gdb: g_try_connecting...  '%s' is not a valid host:server\n",
@@ -322,7 +326,7 @@ char *id;
        /*----------------------------------------------------------*/
 
 
-       bcopy(peer_host->h_addr, (char *)&target.sin_addr, peer_host->h_length);
+       memcpy((char *)&target.sin_addr,peer_host->h_addr,peer_host->h_length);
        target.sin_family = peer_host->h_addrtype;
 
        /*----------------------------------------------------------*/
@@ -364,7 +368,8 @@ char *id;
        return TRUE;
 
 }
-\f
+
+
 /************************************************************************/
 /*     
 /*                     g_parse_target
@@ -468,7 +473,8 @@ u_short *port;
                *port = serv->s_port;
        }
 }
-\f
+
+
 /************************************************************************/
 /*     
 /*                     g_try_accepting
@@ -535,7 +541,7 @@ char *id;
        /*      
        /*----------------------------------------------------------*/
 
-       bzero((char *)&self, sizeof(self));
+       memset((char *)&self, 0, sizeof(self));
        g_parse_target(id, &peer_host, &self.sin_port);
        if (peer_host == NULL) {
                GDB_GIVEUP("gdb_try_accepting: bad port not caught by try connecting")
@@ -574,7 +580,7 @@ char *id;
                                                /* of pending non-accepted */
                                                /* cons.*/
        fromlen = sizeof(from);
-       peer = accept(slisten, &from, &fromlen);
+       peer = accept(slisten, (struct sockaddr *)&from, &fromlen);
        if (peer < 0) {
                g_stop_with_errno(con);
                gdb_perror("gdb_try_accepting: error accepting connection");
@@ -598,7 +604,8 @@ char *id;
        con->out.fd = peer;
        con->status = CON_STARTING;
 }
-\f
+
+
 /************************************************************************/
 /*     
 /*                     g_ver_oprotocol
@@ -647,11 +654,12 @@ CONNECTION con;
                con->status = CON_UP;
        else
                con->status = CON_STOPPED;
-#else !VERIFY_PROTOCOL
+#else
        con->status = CON_UP;
-#endif !VERIFY_PROTOCOL
+#endif
 }
 
+
 /************************************************************************/
 /*     
 /*                     g_ver_iprotocol
@@ -700,12 +708,12 @@ CONNECTION con;
                g_stop_with_errno(con);
                return;
        }
-#else   !VERIFY_PROTOCOL
+#else
        con->status = CON_UP;
 #endif
 }
 
-\f
+
 /************************************************************************/
 /*     
 /*                     sever_connection (sever_connection)
@@ -735,6 +743,7 @@ CONNECTION con;
        return NULL;
 }
 
+
 /************************************************************************/
 /*     
 /*                     g_stop_with_errno
@@ -745,7 +754,6 @@ CONNECTION con;
 /*     
 /************************************************************************/
 
-
 int
 g_stop_with_errno(con)
 CONNECTION con;
@@ -755,6 +763,7 @@ CONNECTION con;
        
 }
 
+
 /************************************************************************/
 /*     
 /*                     g_stop_connection
@@ -805,7 +814,7 @@ CONNECTION con;
        return;
 }
 
-\f
+
 /************************************************************************/
 /*     
 /*                     gdb_de_allocate_connection
@@ -833,7 +842,8 @@ CONNECTION con;
 
        gdb_mcons = i + 1;
 }
-\f
+
+
 /************************************************************************/
 /*     
 /*                     g_cleanup_half_conection
@@ -866,7 +876,8 @@ HALF_CONNECTION hcon;
                current = next;
        }
 }
-\f
+
+
 /************************************************************************/
 /*     
 /*                 create_listening_connection (create_listening_connection)
@@ -957,7 +968,7 @@ char *id;
        /*      
        /*----------------------------------------------------------*/
 
-       bzero((char *)&self, sizeof(self));
+       memset((char *)&self, 0, sizeof(self));
        /*
         * Determine our port number
         */
@@ -1009,7 +1020,8 @@ char *id;
                gdb_mfd = con->in.fd + 1;
        return con;
 }
-\f
+
+
 /************************************************************************/
 /*     
 /*                     g_allocate_connection_buffers
This page took 0.045864 seconds and 4 git commands to generate.