3 #include <netinet/in.h>
6 main(int argc
, char *argv
[])
8 struct protoent_data pvd
;
9 struct protoent
*pvp
, pv
;
12 (void)memset(&pvd
, 0, sizeof(pvd
));
13 setprotoent_r(0, &pvd
);
14 while ((pvp
= getprotoent_r(&pv
, &pvd
)) != NULL
) {
15 printf("name=%s, port=%d, aliases=",
16 pvp
->p_name
, pvp
->p_proto
);
17 for (pp
= pvp
->p_aliases
; *pp
; pp
++)