Import Gnulib's `setenv' module, for MinGW.
[bpt/guile.git] / lib / arpa_inet.in.h
CommitLineData
8912421c
LC
1/* A GNU-like <arpa/inet.h>.
2
f0007cad 3 Copyright (C) 2005-2006, 2008-2012 Free Software Foundation, Inc.
8912421c
LC
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation; either version 2, or (at your option)
8 any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
16 along with this program; if not, write to the Free Software Foundation,
17 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
18
3d458a81 19#ifndef _@GUARD_PREFIX@_ARPA_INET_H
8912421c 20
a927b6c1
LC
21#if __GNUC__ >= 3
22@PRAGMA_SYSTEM_HEADER@
23#endif
0f00f2c3
LC
24@PRAGMA_COLUMNS@
25
26#if @HAVE_FEATURES_H@
27# include <features.h> /* for __GLIBC__ */
28#endif
a927b6c1 29
dd7d0148
LC
30/* Gnulib's sys/socket.h is responsible for defining socklen_t (used below) and
31 for pulling in winsock2.h etc. under MinGW.
61cd9dc9
LC
32 But avoid namespace pollution on glibc systems. */
33#ifndef __GLIBC__
34# include <sys/socket.h>
35#endif
8912421c 36
49114fd4
LC
37/* On NonStop Kernel, inet_ntop and inet_pton are declared in <netdb.h>.
38 But avoid namespace pollution on glibc systems. */
39#if defined __TANDEM && !defined __GLIBC__
40# include <netdb.h>
41#endif
42
8912421c
LC
43#if @HAVE_ARPA_INET_H@
44
8912421c
LC
45/* The include_next requires a split double-inclusion guard. */
46# @INCLUDE_NEXT@ @NEXT_ARPA_INET_H@
47
48#endif
49
3d458a81
AW
50#ifndef _@GUARD_PREFIX@_ARPA_INET_H
51#define _@GUARD_PREFIX@_ARPA_INET_H
8912421c 52
49114fd4
LC
53/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
54
1cd4fffc
LC
55/* The definition of _GL_ARG_NONNULL is copied here. */
56
61cd9dc9
LC
57/* The definition of _GL_WARN_ON_USE is copied here. */
58
8912421c
LC
59
60#if @GNULIB_INET_NTOP@
8912421c
LC
61/* Converts an internet address from internal format to a printable,
62 presentable format.
63 AF is an internet address family, such as AF_INET or AF_INET6.
64 SRC points to a 'struct in_addr' (for AF_INET) or 'struct in6_addr'
65 (for AF_INET6).
66 DST points to a buffer having room for CNT bytes.
67 The printable representation of the address (in numeric form, not
68 surrounded by [...], no reverse DNS is done) is placed in DST, and
69 DST is returned. If an error occurs, the return value is NULL and
70 errno is set. If CNT bytes are not sufficient to hold the result,
71 the return value is NULL and errno is set to ENOSPC. A good value
72 for CNT is 46.
73
74 For more details, see the POSIX:2001 specification
75 <http://www.opengroup.org/susv3xsh/inet_ntop.html>. */
35428fb6
LC
76# if @REPLACE_INET_NTOP@
77# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
78# undef inet_ntop
79# define inet_ntop rpl_inet_ntop
80# endif
81_GL_FUNCDECL_RPL (inet_ntop, const char *,
82 (int af, const void *restrict src,
83 char *restrict dst, socklen_t cnt)
84 _GL_ARG_NONNULL ((2, 3)));
85_GL_CXXALIAS_RPL (inet_ntop, const char *,
86 (int af, const void *restrict src,
87 char *restrict dst, socklen_t cnt));
88# else
89# if !@HAVE_DECL_INET_NTOP@
49114fd4
LC
90_GL_FUNCDECL_SYS (inet_ntop, const char *,
91 (int af, const void *restrict src,
92 char *restrict dst, socklen_t cnt)
93 _GL_ARG_NONNULL ((2, 3)));
35428fb6 94# endif
49114fd4
LC
95/* Need to cast, because on NonStop Kernel, the fourth parameter is
96 size_t cnt. */
97_GL_CXXALIAS_SYS_CAST (inet_ntop, const char *,
98 (int af, const void *restrict src,
99 char *restrict dst, socklen_t cnt));
35428fb6 100# endif
49114fd4 101_GL_CXXALIASWARN (inet_ntop);
8912421c
LC
102#elif defined GNULIB_POSIXCHECK
103# undef inet_ntop
61cd9dc9
LC
104# if HAVE_RAW_DECL_INET_NTOP
105_GL_WARN_ON_USE (inet_ntop, "inet_ntop is unportable - "
106 "use gnulib module inet_ntop for portability");
107# endif
8912421c
LC
108#endif
109
110#if @GNULIB_INET_PTON@
35428fb6
LC
111# if @REPLACE_INET_PTON@
112# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
113# undef inet_pton
114# define inet_pton rpl_inet_pton
115# endif
116_GL_FUNCDECL_RPL (inet_pton, int,
117 (int af, const char *restrict src, void *restrict dst)
118 _GL_ARG_NONNULL ((2, 3)));
119_GL_CXXALIAS_RPL (inet_pton, int,
120 (int af, const char *restrict src, void *restrict dst));
121# else
122# if !@HAVE_DECL_INET_PTON@
49114fd4
LC
123_GL_FUNCDECL_SYS (inet_pton, int,
124 (int af, const char *restrict src, void *restrict dst)
125 _GL_ARG_NONNULL ((2, 3)));
35428fb6 126# endif
49114fd4
LC
127_GL_CXXALIAS_SYS (inet_pton, int,
128 (int af, const char *restrict src, void *restrict dst));
35428fb6 129# endif
49114fd4 130_GL_CXXALIASWARN (inet_pton);
8912421c
LC
131#elif defined GNULIB_POSIXCHECK
132# undef inet_pton
61cd9dc9
LC
133# if HAVE_RAW_DECL_INET_PTON
134_GL_WARN_ON_USE (inet_pton, "inet_pton is unportable - "
135 "use gnulib module inet_pton for portability");
136# endif
8912421c
LC
137#endif
138
8912421c 139
3d458a81
AW
140#endif /* _@GUARD_PREFIX@_ARPA_INET_H */
141#endif /* _@GUARD_PREFIX@_ARPA_INET_H */