conformance fixes
[libc-test.git] / src / api / arpa_inet.c
blobb6b63563a2d40e9e9246f73717d77c9fded9b6e2
1 #include <arpa/inet.h>
2 #define T(t) (t*)0;
3 #define C(n) switch(n){case n:;}
4 #define I(t,e) {t x[sizeof(t)==sizeof(e)] = {e};}
5 static void f()
7 T(in_port_t)
8 T(in_addr_t)
9 T(struct in_addr)
10 T(uint32_t)
11 T(uint16_t)
13 C(INET_ADDRSTRLEN)
14 C(INET6_ADDRSTRLEN)
16 #ifdef htonl
17 I(uint32_t, htonl(0LL))
18 #else
19 {uint32_t(*p)(uint32_t) = htonl;}
20 #endif
21 #ifdef htons
22 I(uint32_t, htons(0LL))
23 #else
24 {uint16_t(*p)(uint16_t) = htons;}
25 #endif
26 #ifdef ntohl
27 I(uint32_t, ntohl(0LL))
28 #else
29 {uint32_t(*p)(uint32_t) = ntohl;}
30 #endif
31 #ifdef ntohs
32 I(uint16_t, ntohs(0LL))
33 #else
34 {uint16_t(*p)(uint16_t) = ntohs;}
35 #endif
37 {in_addr_t(*p)(const char*) = inet_addr;}
38 {char*(*p)(struct in_addr) = inet_ntoa;}
39 {const char*(*p)(int,const void*restrict,char*restrict,socklen_t) = inet_ntop;}
40 {int(*p)(int,const char*restrict,void*restrict) = inet_pton;}