xref: /titanic_41/usr/src/cmd/ipf/lib/common/gethost.c (revision 70025d765b044c6d8594bb965a2247a61e991a99)
1 #include "ipf.h"
2 
3 int gethost(name, hostp)
4 char *name;
5 u_32_t *hostp;
6 {
7 	struct hostent *h;
8 	u_32_t addr;
9 
10 	if (!strcmp(name, "<thishost>"))
11 		name = thishost;
12 
13 	h = gethostbyname(name);
14 	if (h != NULL) {
15 		if ((h->h_addr != NULL) && (h->h_length == sizeof(addr))) {
16 			bcopy(h->h_addr, (char *)&addr, sizeof(addr));
17 			*hostp = addr;
18 			return 0;
19 		}
20 	}
21 	return -1;
22 }
23