121380Sdist /* 221380Sdist * Copyright (c) 1983 Regents of the University of California. 321380Sdist * All rights reserved. The Berkeley software License Agreement 421380Sdist * specifies the terms and conditions for redistribution. 521380Sdist */ 67900Ssam 7*26621Sdonn #if defined(LIBC_SCCS) && !defined(lint) 8*26621Sdonn static char sccsid[] = "@(#)getprotoname.c 5.2 (Berkeley) 03/09/86"; 9*26621Sdonn #endif LIBC_SCCS and not lint 1021380Sdist 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