xref: /titanic_44/usr/src/cmd/ipf/lib/common/gethost.c (revision 8eea8e29cc4374d1ee24c25a07f45af132db3499)
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