]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Cygwin portability.
authorBruno Haible <bruno@clisp.org>
Wed, 1 May 2002 00:24:46 +0000 (00:24 +0000)
committerBruno Haible <bruno@clisp.org>
Tue, 23 Jun 2009 10:07:56 +0000 (12:07 +0200)
src/ChangeLog
src/hostname.c

index a601f32629b789a9b78919febed318b723328a1b..c700b39080c11d4ac0905f1f2f754548555c30d6 100644 (file)
@@ -1,3 +1,9 @@
+2002-04-30  Bruno Haible  <bruno@clisp.org>
+
+       * hostname.c (ipv6_ntop): Provide a fallback definition for systems
+       that define s6_addr but no s6_addr16 element of 'struct in6_addr'.
+       Reported by Perry Rapp <PRapp@smartronix.com>.
+
 2002-04-28  Bruno Haible  <bruno@clisp.org>
 
        * project-id: Recognize package name and version when given by a
index 88bff6f2545ea2742ec787f29f40d25b2430cddf..5380999e4a0ebcdbd298088fe2bc0cd27191922d 100644 (file)
 #  include <arpa/inet.h> /* declares inet_ntoa(), inet_ntop() */
 # endif
 # if HAVE_IPV6
-#  if defined(__APPLE__) && defined(__MACH__) /* MacOS X */
-#   define in6_u __u6_addr
-#   define u6_addr16 __u6_addr16
-#  endif
-   /* Use s6_addr16 for portability.  See RFC 2553.  */
-#  ifndef s6_addr16
-#   define s6_addr16 in6_u.u6_addr16
+#  if !defined(__CYGWIN__) /* Cygwin has only s6_addr, no s6_addr16 */
+#   if defined(__APPLE__) && defined(__MACH__) /* MacOS X */
+#    define in6_u __u6_addr
+#    define u6_addr16 __u6_addr16
+#   endif
+    /* Use s6_addr16 for portability.  See RFC 2553.  */
+#   ifndef s6_addr16
+#    define s6_addr16 in6_u.u6_addr16
+#   endif
+#   define HAVE_IN6_S6_ADDR16 1
 #  endif
 # endif
 # include <netdb.h> /* defines struct hostent, declares gethostbyname() */
@@ -271,7 +274,7 @@ xgethostname ()
 # if HAVE_INET_NTOP
 #  define ipv6_ntop(buffer,addr) \
      inet_ntop (AF_INET6, &addr, buffer, 45+1)
-# else
+# elif HAVE_IN6_S6_ADDR16
 #  define ipv6_ntop(buffer,addr) \
      sprintf (buffer, "%x:%x:%x:%x:%x:%x:%x:%x", \
              ntohs ((addr).s6_addr16[0]), \
@@ -282,6 +285,17 @@ xgethostname ()
              ntohs ((addr).s6_addr16[5]), \
              ntohs ((addr).s6_addr16[6]), \
              ntohs ((addr).s6_addr16[7]))
+# else
+#  define ipv6_ntop(buffer,addr) \
+     sprintf (buffer, "%x:%x:%x:%x:%x:%x:%x:%x", \
+             ((addr).s6_addr[0] << 8) | (addr).s6_addr[1], \
+             ((addr).s6_addr[2] << 8) | (addr).s6_addr[3], \
+             ((addr).s6_addr[4] << 8) | (addr).s6_addr[5], \
+             ((addr).s6_addr[6] << 8) | (addr).s6_addr[7], \
+             ((addr).s6_addr[8] << 8) | (addr).s6_addr[9], \
+             ((addr).s6_addr[10] << 8) | (addr).s6_addr[11], \
+             ((addr).s6_addr[12] << 8) | (addr).s6_addr[13], \
+             ((addr).s6_addr[14] << 8) | (addr).s6_addr[15])
 # endif
 #endif