1 /* 2 * Copyright (c) 1983, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * %sccs.include.redist.c% 6 */ 7 8 #if defined(LIBC_SCCS) && !defined(lint) 9 static char sccsid[] = "@(#)getnetbyaddr.c 8.1 (Berkeley) 06/04/93"; 10 #endif /* LIBC_SCCS and not lint */ 11 12 #include <netdb.h> 13 14 extern int _net_stayopen; 15 16 struct netent * 17 getnetbyaddr(net, type) 18 register long net; 19 register int type; 20 { 21 register struct netent *p; 22 23 setnetent(_net_stayopen); 24 while (p = getnetent()) 25 if (p->n_addrtype == type && p->n_net == net) 26 break; 27 if (!_net_stayopen) 28 endnetent(); 29 return (p); 30 } 31