xref: /titanic_41/usr/src/cmd/ipf/lib/common/gethost.c (revision 1ae0874509b6811fdde1dfd46f0d93fd09867a3f)
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