1 // RUN: %clangxx -O0 -g %s -o %t && %run %t 2>&1 | FileCheck %s
7 #define STRING_OR_NULL(x) ((x) ? (x) : "null")
10 struct protoent
*ptp
= getprotoent();
12 printf("%s ", STRING_OR_NULL(ptp
->p_name
));
14 for (char **cp
= ptp
->p_aliases
; *cp
!= NULL
; cp
++)
15 printf("%s ", STRING_OR_NULL(*cp
));
17 printf("%d\n", ptp
->p_proto
);
22 struct protoent
*ptp
= getprotobyname("icmp");
24 printf("%s ", STRING_OR_NULL(ptp
->p_name
));
26 for (char **cp
= ptp
->p_aliases
; *cp
!= NULL
; cp
++)
27 printf("%s ", STRING_OR_NULL(*cp
));
29 printf("%d\n", ptp
->p_proto
);
34 struct protoent
*ptp
= getprotobynumber(1);
36 printf("%s ", STRING_OR_NULL(ptp
->p_name
));
38 for (char **cp
= ptp
->p_aliases
; *cp
!= NULL
; cp
++)
39 printf("%s ", STRING_OR_NULL(*cp
));
41 printf("%d\n", ptp
->p_proto
);
47 struct protoent
*ptp
= getprotobynumber(1);
49 ptp
= getprotobynumber(2);
51 printf("%s ", STRING_OR_NULL(ptp
->p_name
));
53 for (char **cp
= ptp
->p_aliases
; *cp
!= NULL
; cp
++)
54 printf("%s ", STRING_OR_NULL(*cp
));
56 printf("%d\n", ptp
->p_proto
);
61 struct protoent
*ptp
= getprotobyname("ttp");
63 printf("%s ", STRING_OR_NULL(ptp
->p_name
));
65 for (char **cp
= ptp
->p_aliases
; *cp
!= NULL
; cp
++)
66 printf("%s ", STRING_OR_NULL(*cp
));
68 printf("%d\n", ptp
->p_proto
);
82 // CHECK: hopopt HOPOPT 0
86 // CHECK: ttp TTP iptm IPTM 84