{get,set,end}protoent_r regressions.

This commit is contained in:
christos 2004-02-19 19:18:48 +00:00
parent 7fc50c9d78
commit 6e311ad824
2 changed files with 34 additions and 0 deletions

View 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>

View 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;
}