- typedef unsigned char address_t[sizeof (struct in_addr)];
- typedef struct _address_e
- {
- struct _address_e *next;
- address_t address;
- }
- address_e;
- address_e *host_a_addr=0, *host_b_addr=0; /* assignments pacify -Wall */
- address_e *dummy_addr;
-
- int i;
- struct hostent *hp;
- char **p;
-
- hp = gethostbyname(name1);
-
- dummy_addr = (address_e *)NULL;
-
- for (i=0,p = hp->h_addr_list; *p != 0; i++,p++)
- {
- struct in_addr in;
- (void) memcpy(&in.s_addr, *p, sizeof (in.s_addr));
- xalloca(host_a_addr, address_e *, sizeof (address_e));
- memset (host_a_addr,0, sizeof (address_e));
- host_a_addr->next = dummy_addr;
- (void) memcpy(&host_a_addr->address, *p, sizeof (in.s_addr));
- dummy_addr = host_a_addr;
- }