1*21376Sdist /* 2*21376Sdist * Copyright (c) 1983 Regents of the University of California. 3*21376Sdist * All rights reserved. The Berkeley software License Agreement 4*21376Sdist * specifies the terms and conditions for redistribution. 5*21376Sdist */ 67897Ssam 7*21376Sdist #ifndef lint 8*21376Sdist static char sccsid[] = "@(#)getnetbyname.c 5.1 (Berkeley) 05/30/85"; 9*21376Sdist #endif not lint 10*21376Sdist 117897Ssam #include <netdb.h> 127897Ssam 137897Ssam struct netent * 148324Ssam getnetbyname(name) 157897Ssam register char *name; 167897Ssam { 177897Ssam register struct netent *p; 187897Ssam register char **cp; 197897Ssam 207897Ssam setnetent(0); 217897Ssam while (p = getnetent()) { 227897Ssam if (strcmp(p->n_name, name) == 0) 237897Ssam break; 247897Ssam for (cp = p->n_aliases; *cp != 0; cp++) 257897Ssam if (strcmp(*cp, name) == 0) 267897Ssam goto found; 277897Ssam } 287897Ssam found: 297897Ssam endnetent(); 307897Ssam return (p); 317897Ssam } 32