|
|
1.1 root 1: /* gethostbyname.c 4.2 82/10/05 */
2:
3: #include <netdb.h>
4:
5: struct hostent *
6: gethostbyname(name)
7: register char *name;
8: {
9: register struct hostent *p;
10: register char **cp;
11:
12: sethostent(0);
13: while (p = gethostent()) {
14: if (strcmp(p->h_name, name) == 0)
15: break;
16: for (cp = p->h_aliases; *cp != 0; cp++)
17: if (strcmp(*cp, name) == 0)
18: goto found;
19: }
20: found:
21: endhostent();
22: return (p);
23: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.