121375Sdist /* 2*61150Sbostic * Copyright (c) 1983, 1993 3*61150Sbostic * The Regents of the University of California. All rights reserved. 433679Sbostic * 542625Sbostic * %sccs.include.redist.c% 621375Sdist */ 77895Ssam 826616Sdonn #if defined(LIBC_SCCS) && !defined(lint) 9*61150Sbostic static char sccsid[] = "@(#)getnetbyaddr.c 8.1 (Berkeley) 06/04/93"; 1033679Sbostic #endif /* LIBC_SCCS and not lint */ 1121375Sdist 127895Ssam #include <netdb.h> 137895Ssam 1428280Slepreau extern int _net_stayopen; 1528280Slepreau 167895Ssam struct netent * getnetbyaddr(net,type)178342Ssamgetnetbyaddr(net, type) 1832296Sbostic register long net; 1932296Sbostic register int type; 207895Ssam { 217895Ssam register struct netent *p; 227895Ssam 2328280Slepreau setnetent(_net_stayopen); 247895Ssam while (p = getnetent()) 258342Ssam if (p->n_addrtype == type && p->n_net == net) 267895Ssam break; 2728280Slepreau if (!_net_stayopen) 2828280Slepreau endnetent(); 297895Ssam return (p); 307895Ssam } 31