1*7900Ssam /* getprotoname.c 4.1 82/08/25 */ 2*7900Ssam 3*7900Ssam #include <netdb.h> 4*7900Ssam 5*7900Ssam struct protoent * 6*7900Ssam getprotoname(name) 7*7900Ssam register char *name; 8*7900Ssam { 9*7900Ssam register struct protoent *p; 10*7900Ssam register char **cp; 11*7900Ssam 12*7900Ssam setprotoent(0); 13*7900Ssam while (p = getprotoent()) { 14*7900Ssam if (strcmp(p->p_name, name) == 0) 15*7900Ssam break; 16*7900Ssam for (cp = p->p_aliases; *cp != 0; cp++) 17*7900Ssam if (strcmp(*cp, name) == 0) 18*7900Ssam goto found; 19*7900Ssam } 20*7900Ssam found: 21*7900Ssam endprotoent(); 22*7900Ssam return (p); 23*7900Ssam } 24