1 // RUN: %clangxx -O0 -g %s -o %t
3 // bionic/netdb.cpp is not implemented.
4 // UNSUPPORTED: android
13 #if defined(__linux__)
14 #define LOOPBACK "loopback"
16 #define LOOPBACK "your-net"
20 struct netent
*ntp
= getnetent();
21 assert(ntp
&& ntp
->n_name
);
22 assert(ntp
->n_addrtype
== 2);
23 assert(ntp
->n_net
== 127);
24 char **aliases
= ntp
->n_aliases
;
26 printf("%s\n", *aliases
);
33 struct netent
*ntp
= getnetbyname(LOOPBACK
);
34 assert(ntp
&& ntp
->n_name
);
35 assert(ntp
->n_addrtype
== 2);
36 assert(ntp
->n_net
== 127);
37 char **aliases
= ntp
->n_aliases
;
39 printf("%s\n", *aliases
);
46 struct netent
*lb
= getnetbyname(LOOPBACK
);
48 struct netent
*ntp
= getnetbyaddr(lb
->n_net
, lb
->n_addrtype
);
49 assert(ntp
&& ntp
->n_name
);
50 assert(ntp
->n_addrtype
== 2);
51 assert(ntp
->n_net
== 127);
52 char **aliases
= ntp
->n_aliases
;
54 printf("%s\n", *aliases
);
63 struct netent
*ntp
= getnetent();
64 assert(ntp
&& ntp
->n_name
);
65 assert(ntp
->n_addrtype
== 2);
66 assert(ntp
->n_net
== 127);