xref: /csrg-svn/lib/libc/net/getnetbyaddr.c (revision 26616)
121375Sdist /*
221375Sdist  * Copyright (c) 1983 Regents of the University of California.
321375Sdist  * All rights reserved.  The Berkeley software License Agreement
421375Sdist  * specifies the terms and conditions for redistribution.
521375Sdist  */
67895Ssam 
7*26616Sdonn #if defined(LIBC_SCCS) && !defined(lint)
8*26616Sdonn static char sccsid[] = "@(#)getnetbyaddr.c	5.2 (Berkeley) 03/09/86";
9*26616Sdonn #endif LIBC_SCCS and not lint
1021375Sdist 
117895Ssam #include <netdb.h>
127895Ssam 
137895Ssam struct netent *
148342Ssam getnetbyaddr(net, type)
158342Ssam 	register int net, type;
167895Ssam {
177895Ssam 	register struct netent *p;
187895Ssam 
197895Ssam 	setnetent(0);
207895Ssam 	while (p = getnetent())
218342Ssam 		if (p->n_addrtype == type && p->n_net == net)
227895Ssam 			break;
237895Ssam 	endnetent();
247895Ssam 	return (p);
257895Ssam }
26