{get,set,end}protoent_r regressions.
This commit is contained in:
parent
7fc50c9d78
commit
6e311ad824
11
regress/lib/libc/protoent/Makefile
Normal file
11
regress/lib/libc/protoent/Makefile
Normal file
@ -0,0 +1,11 @@
|
||||
# $NetBSD: Makefile,v 1.1 2004/02/19 19:18:48 christos Exp $
|
||||
|
||||
NOMAN= # defined
|
||||
|
||||
PROG= protoent
|
||||
CPPFLAGS=-D_REENTRANT
|
||||
|
||||
regress: ${PROG}
|
||||
${.CURDIR}/../servent/compare /etc/protocols $>
|
||||
|
||||
.include <bsd.prog.mk>
|
23
regress/lib/libc/protoent/protoent.c
Normal file
23
regress/lib/libc/protoent/protoent.c
Normal file
@ -0,0 +1,23 @@
|
||||
#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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user