bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gettext-0.11.2 fails for me because I have not in6_addr.in6_u (rathe


From: Bruno Haible
Subject: Re: gettext-0.11.2 fails for me because I have not in6_addr.in6_u (rather I have in6_addr.s6_addr)
Date: Tue, 30 Apr 2002 16:46:04 +0200 (CEST)

Perry Rapp writes:
> FYI: What I did to make gettext-0.11.2 compile successfully on Win2000,
> cygwin, gcc-2.95.3-5
> ...
> I fail to compile because s6_addr is an actual member of the
> in6_addr structure on my platform, whereas in6_u is not.
> To wit, quoting /usr/include/cygwin/in.h, lines (175-178)
> ** BEGIN
> struct in6_addr
> {
>         unsigned char s6_addr[16];
> };
> ** END

Thanks for the report; I'll use the following patch.

Bruno


diff -r -c3 --exclude='*.po*' --exclude='*.info*' --exclude='*.html' 
--exclude=Makefile.in --exclude=aclocal.m4 --exclude=configure 
gettext-0/src/hostname.c gettext-1/src/hostname.c
*** gettext-0/src/hostname.c    2002-03-05 22:14:32.000000000 +0100
--- gettext-1/src/hostname.c    2002-04-30 02:20:01.000000000 +0200
***************
*** 59,71 ****
  #  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
  #  endif
  # endif
  # include <netdb.h> /* defines struct hostent, declares gethostbyname() */
--- 59,74 ----
  #  include <arpa/inet.h> /* declares inet_ntoa(), inet_ntop() */
  # endif
  # if HAVE_IPV6
! #  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,277 ****
  # if HAVE_INET_NTOP
  #  define ipv6_ntop(buffer,addr) \
       inet_ntop (AF_INET6, &addr, buffer, 45+1)
! # else
  #  define ipv6_ntop(buffer,addr) \
       sprintf (buffer, "%x:%x:%x:%x:%x:%x:%x:%x", \
              ntohs ((addr).s6_addr16[0]), \
--- 274,280 ----
  # if HAVE_INET_NTOP
  #  define ipv6_ntop(buffer,addr) \
       inet_ntop (AF_INET6, &addr, buffer, 45+1)
! # 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,287 ****
--- 285,301 ----
              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
  



reply via email to

[Prev in Thread] Current Thread [Next in Thread]