xref: /csrg-svn/lib/libc/net/getnetbyaddr.c (revision 21375)
1*21375Sdist /*
2*21375Sdist  * Copyright (c) 1983 Regents of the University of California.
3*21375Sdist  * All rights reserved.  The Berkeley software License Agreement
4*21375Sdist  * specifies the terms and conditions for redistribution.
5*21375Sdist  */
67895Ssam 
7*21375Sdist #ifndef lint
8*21375Sdist static char sccsid[] = "@(#)getnetbyaddr.c	5.1 (Berkeley) 05/30/85";
9*21375Sdist #endif not lint
10*21375Sdist 
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