Re: [PATCH] move socket-related client parts into separate file

Alexey Mahotkin <[email protected]>
Newsgroups gmane.comp.version-control.cvs.bugs
Message-ID <[email protected]>
>>>>> "DRP" == Derek Robert Price <[email protected]> writes:

 DRP> Actually, I'd rather make the whole file not compile at all at the
 DRP> Makefile level when NO_SOCKET_TO_FD is defined.  

No, sorry :)


Move init_sockaddr() to socket-client.[ch], to be used later by
GSSAPI/Kerberos


 src/client.c        |   25 -------------------------
 src/socket-client.c |   27 +++++++++++++++++++++++++++
 src/socket-client.h |    2 ++
 3 files changed, 29 insertions(+), 25 deletions(-)

--- ccvs/src/client.c~socket-client	Wed May  7 21:29:37 2003
+++ ccvs-alexm/src/client.c	Wed May  7 21:30:40 2003
@@ -3112,31 +3112,6 @@ supported_request (name)
 
 
 #if defined (AUTH_CLIENT_SUPPORT) || defined (HAVE_KERBEROS) || defined (HAVE_GSSAPI)
-static struct hostent *init_sockaddr PROTO ((struct sockaddr_in *, char *,
-					     unsigned int));
-
-static struct hostent *
-init_sockaddr (name, hostname, port)
-    struct sockaddr_in *name;
-    char *hostname;
-    unsigned int port;
-{
-    struct hostent *hostinfo;
-    unsigned short shortport = port;
-
-    memset (name, 0, sizeof (*name));
-    name->sin_family = AF_INET;
-    name->sin_port = htons (shortport);
-    hostinfo = gethostbyname (hostname);
-    if (hostinfo == NULL)
-    {
-	fprintf (stderr, "Unknown host %s.\n", hostname);
-	error_exit ();
-    }
-    name->sin_addr = *(struct in_addr *) hostinfo->h_addr;
-    return hostinfo;
-}
-
 
 
 /* Generic function to do port number lookup tasks.
--- ccvs/src/socket-client.c~socket-client	Wed May  7 21:29:37 2003
+++ ccvs-alexm/src/socket-client.c	Wed May  7 21:32:46 2003
@@ -17,6 +17,33 @@
 
 #include "socket-client.h"
 
+
+#if defined (AUTH_CLIENT_SUPPORT) || defined (HAVE_KERBEROS) || defined (HAVE_GSSAPI)
+
+struct hostent *
+init_sockaddr (name, hostname, port)
+    struct sockaddr_in *name;
+    char *hostname;
+    unsigned int port;
+{
+    struct hostent *hostinfo;
+    unsigned short shortport = port;
+
+    memset (name, 0, sizeof (*name));
+    name->sin_family = AF_INET;
+    name->sin_port = htons (shortport);
+    hostinfo = gethostbyname (hostname);
+    if (hostinfo == NULL)
+    {
+	fprintf (stderr, "Unknown host %s.\n", hostname);
+	error_exit ();
+    }
+    name->sin_addr = *(struct in_addr *) hostinfo->h_addr;
+    return hostinfo;
+}
+
+#endif
+
 #ifdef NO_SOCKET_TO_FD
 
 /* Under certain circumstances, we must communicate with the server
--- ccvs/src/socket-client.h~socket-client	Wed May  7 21:29:37 2003
+++ ccvs-alexm/src/socket-client.h	Wed May  7 21:31:52 2003
@@ -52,4 +52,6 @@ extern char *strerror ();
 #   endif
 # endif /* ! SOCK_STRERROR */
 
+struct hostent *init_sockaddr PROTO ((struct sockaddr_in *, char *, unsigned int));
+
 #endif /* SOCKET_CLIENT_H__ */

_


--alexm
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.