NetBSD/regress/lib/libc/protoent/protoent.c

24 lines
469 B
C
Raw Normal View History

2004-02-19 22:18:48 +03:00
#include <netdb.h>
#include <stdint.h>
#include <netinet/in.h>
int
main(int argc, char *argv[])
{
struct protoent_data pvd;
struct protoent *pvp, pv;
char **pp;
(void)memset(&pvd, 0, sizeof(pvd));
setprotoent_r(0, &pvd);
while ((pvp = getprotoent_r(&pv, &pvd)) != NULL) {
printf("name=%s, port=%d, aliases=",
pvp->p_name, pvp->p_proto);
for (pp = pvp->p_aliases; *pp; pp++)
printf("%s ", *pp);
printf("\n");
}
endprotoent_r(&pvd);
return 0;
}