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