1 // RUN: %clangxx -O0 -g %s -o %t && %run %t 2>&1 | FileCheck %s
9 #define STRING_OR_NULL(x) ((x) ? (x) : "null")
12 struct netent
*ntp
= getnetent();
14 printf("%s ", ntp
->n_name
);
16 for (char **cp
= ntp
->n_aliases
; *cp
!= NULL
; cp
++)
17 printf("%s ", STRING_OR_NULL(*cp
));
19 printf("%d ", ntp
->n_addrtype
);
20 printf("%" PRIu32
"\n", ntp
->n_net
);
26 struct netent
*ntp
= getnetbyname("loopback");
28 printf("%s ", ntp
->n_name
);
30 for (char **cp
= ntp
->n_aliases
; *cp
!= NULL
; cp
++)
31 printf("%s ", STRING_OR_NULL(*cp
));
33 printf("%d ", ntp
->n_addrtype
);
34 printf("%" PRIu32
"\n", ntp
->n_net
);
40 struct netent
*ntp
= getnetbyaddr(127, 2);
42 printf("%s ", ntp
->n_name
);
44 for (char **cp
= ntp
->n_aliases
; *cp
!= NULL
; cp
++)
45 printf("%s ", STRING_OR_NULL(*cp
));
47 printf("%d ", ntp
->n_addrtype
);
48 printf("%" PRIu32
"\n", ntp
->n_net
);
56 struct netent
*ntp
= getnetent();
58 printf("%s ", ntp
->n_name
);
60 for (char **cp
= ntp
->n_aliases
; *cp
!= NULL
; cp
++)
61 printf("%s ", STRING_OR_NULL(*cp
));
63 printf("%d ", ntp
->n_addrtype
);
64 printf("%" PRIu32
"\n", ntp
->n_net
);
78 // CHECK: loopback 2 127
79 // CHECK: loopback 2 127
80 // CHECK: loopback 2 127
81 // CHECK: loopback 2 127