Sync usage with man page.
[netbsd-mini2440.git] / regress / lib / libc / protoent / protoent.c
blobb3f6394f9ff34a9b00b64f4cebc6ffabf0dddd5e
1 #include <netdb.h>
2 #include <stdint.h>
3 #include <netinet/in.h>
5 int
6 main(int argc, char *argv[])
8 struct protoent_data pvd;
9 struct protoent *pvp, pv;
10 char **pp;
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++)
18 printf("%s ", *pp);
19 printf("\n");
21 endprotoent_r(&pvd);
22 return 0;