1*21380Sdist /* 2*21380Sdist * Copyright (c) 1983 Regents of the University of California. 3*21380Sdist * All rights reserved. The Berkeley software License Agreement 4*21380Sdist * specifies the terms and conditions for redistribution. 5*21380Sdist */ 67900Ssam 7*21380Sdist #ifndef lint 8*21380Sdist static char sccsid[] = "@(#)getprotoname.c 5.1 (Berkeley) 05/30/85"; 9*21380Sdist #endif not lint 10*21380Sdist 117900Ssam #include <netdb.h> 127900Ssam 137900Ssam struct protoent * 148324Ssam getprotobyname(name) 157900Ssam register char *name; 167900Ssam { 177900Ssam register struct protoent *p; 187900Ssam register char **cp; 197900Ssam 207900Ssam setprotoent(0); 217900Ssam while (p = getprotoent()) { 227900Ssam if (strcmp(p->p_name, name) == 0) 237900Ssam break; 247900Ssam for (cp = p->p_aliases; *cp != 0; cp++) 257900Ssam if (strcmp(*cp, name) == 0) 267900Ssam goto found; 277900Ssam } 287900Ssam found: 297900Ssam endprotoent(); 307900Ssam return (p); 317900Ssam } 32