new library routines
[unix-history] / usr / src / lib / libc / net / getprotoname.c
CommitLineData
723e6dff
SL
1/* getprotoname.c 4.1 82/08/25 */
2
3#include <netdb.h>
4
5struct protoent *
6getprotoname(name)
7 register char *name;
8{
9 register struct protoent *p;
10 register char **cp;
11
12 setprotoent(0);
13 while (p = getprotoent()) {
14 if (strcmp(p->p_name, name) == 0)
15 break;
16 for (cp = p->p_aliases; *cp != 0; cp++)
17 if (strcmp(*cp, name) == 0)
18 goto found;
19 }
20found:
21 endprotoent();
22 return (p);
23}