1*8324Ssam /* getprotoname.c 4.2 82/10/05 */ 27900Ssam 37900Ssam #include <netdb.h> 47900Ssam 57900Ssam struct protoent * 6*8324Ssam getprotobyname(name) 77900Ssam register char *name; 87900Ssam { 97900Ssam register struct protoent *p; 107900Ssam register char **cp; 117900Ssam 127900Ssam setprotoent(0); 137900Ssam while (p = getprotoent()) { 147900Ssam if (strcmp(p->p_name, name) == 0) 157900Ssam break; 167900Ssam for (cp = p->p_aliases; *cp != 0; cp++) 177900Ssam if (strcmp(*cp, name) == 0) 187900Ssam goto found; 197900Ssam } 207900Ssam found: 217900Ssam endprotoent(); 227900Ssam return (p); 237900Ssam } 24