summaryrefslogtreecommitdiff
path: root/lib/inet_ntop.c
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2011-10-22 16:24:32 +0200
committerLudovic Courtès <ludo@gnu.org>2011-10-22 16:24:32 +0200
commit35428fb6b2d269dbfa2eec7d0739aec149bd4cc2 (patch)
tree03146c5871ad9b2167f3dffc89fdbb3082d7fc4e /lib/inet_ntop.c
parentfe4ea6859e7d19a0fe2694a3fb49f4abb722afc1 (diff)
downloadguile-35428fb6b2d269dbfa2eec7d0739aec149bd4cc2.tar.gz
Update Gnulib to v0.0-6523-gb3609c1.
Diffstat (limited to 'lib/inet_ntop.c')
-rw-r--r--lib/inet_ntop.c39
1 files changed, 27 insertions, 12 deletions
diff --git a/lib/inet_ntop.c b/lib/inet_ntop.c
index 64f90a1fd..6b5cbe5c1 100644
--- a/lib/inet_ntop.c
+++ b/lib/inet_ntop.c
@@ -38,12 +38,25 @@
/* Specification. */
#include <arpa/inet.h>
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
+#if HAVE_DECL_INET_NTOP
-#define NS_IN6ADDRSZ 16
-#define NS_INT16SZ 2
+# undef inet_ntop
+
+const char *
+rpl_inet_ntop (int af, const void *restrict src,
+ char *restrict dst, socklen_t cnt)
+{
+ return inet_ntop (af, src, dst, cnt);
+}
+
+#else
+
+# include <stdio.h>
+# include <string.h>
+# include <errno.h>
+
+# define NS_IN6ADDRSZ 16
+# define NS_INT16SZ 2
/*
* WARNING: Don't even consider trying to compile this on a system where
@@ -52,9 +65,9 @@
typedef int verify_int_size[4 <= sizeof (int) ? 1 : -1];
static const char *inet_ntop4 (const unsigned char *src, char *dst, socklen_t size);
-#if HAVE_IPV6
+# if HAVE_IPV6
static const char *inet_ntop6 (const unsigned char *src, char *dst, socklen_t size);
-#endif
+# endif
/* char *
@@ -71,15 +84,15 @@ inet_ntop (int af, const void *restrict src,
{
switch (af)
{
-#if HAVE_IPV4
+# if HAVE_IPV4
case AF_INET:
return (inet_ntop4 (src, dst, cnt));
-#endif
+# endif
-#if HAVE_IPV6
+# if HAVE_IPV6
case AF_INET6:
return (inet_ntop6 (src, dst, cnt));
-#endif
+# endif
default:
errno = EAFNOSUPPORT;
@@ -118,7 +131,7 @@ inet_ntop4 (const unsigned char *src, char *dst, socklen_t size)
return strcpy (dst, tmp);
}
-#if HAVE_IPV6
+# if HAVE_IPV6
/* const char *
* inet_ntop6(src, dst, size)
@@ -231,4 +244,6 @@ inet_ntop6 (const unsigned char *src, char *dst, socklen_t size)
return strcpy (dst, tmp);
}
+# endif
+
#endif