121376Sdist /* 221376Sdist * Copyright (c) 1983 Regents of the University of California. 333679Sbostic * All rights reserved. 433679Sbostic * 5*42625Sbostic * %sccs.include.redist.c% 621376Sdist */ 77897Ssam 826617Sdonn #if defined(LIBC_SCCS) && !defined(lint) 9*42625Sbostic static char sccsid[] = "@(#)getnetbyname.c 5.6 (Berkeley) 06/01/90"; 1033679Sbostic #endif /* LIBC_SCCS and not lint */ 1121376Sdist 127897Ssam #include <netdb.h> 137897Ssam 1428280Slepreau extern int _net_stayopen; 1528280Slepreau 167897Ssam struct netent * 178324Ssam getnetbyname(name) 187897Ssam register char *name; 197897Ssam { 207897Ssam register struct netent *p; 217897Ssam register char **cp; 227897Ssam 2328280Slepreau setnetent(_net_stayopen); 247897Ssam while (p = getnetent()) { 257897Ssam if (strcmp(p->n_name, name) == 0) 267897Ssam break; 277897Ssam for (cp = p->n_aliases; *cp != 0; cp++) 287897Ssam if (strcmp(*cp, name) == 0) 297897Ssam goto found; 307897Ssam } 317897Ssam found: 3228280Slepreau if (!_net_stayopen) 3328280Slepreau endnetent(); 347897Ssam return (p); 357897Ssam } 36