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