Commit 978afa4f1d5e78eb4a43bc3cc81b54b3878070f5
1 parent
83cfc466
Exists in
master
and in
3 other branches
Pequenos ajustes para compilação em windows
Showing
1 changed file
with
11 additions
and
11 deletions
Show diff stats
resolver.c
... | ... | @@ -86,7 +86,7 @@ struct parms |
86 | 86 | */ |
87 | 87 | static int cresolve_host_and_port(H3270 *h, struct parms *p) |
88 | 88 | { |
89 | -#ifdef HAVE_GETADDRINFO | |
89 | +#if defined( HAVE_GETADDRINFO ) || defined(WIN32) | |
90 | 90 | |
91 | 91 | struct addrinfo hints, *res; |
92 | 92 | int rc; |
... | ... | @@ -136,15 +136,15 @@ static int cresolve_host_and_port(H3270 *h, struct parms *p) |
136 | 136 | unsigned short port; |
137 | 137 | unsigned long lport; |
138 | 138 | char *ptr; |
139 | - struct sockaddr_in *sin = (struct sockaddr_in *)sa; | |
139 | + struct sockaddr_in *sin = (struct sockaddr_in *) p->sa; | |
140 | 140 | |
141 | 141 | /* Get the port number. */ |
142 | - lport = strtoul(portname, &ptr, 0); | |
143 | - if (ptr == portname || *ptr != '\0' || lport == 0L || lport & ~0xffff) | |
142 | + lport = strtoul(p->portname, &ptr, 0); | |
143 | + if (ptr == p->portname || *ptr != '\0' || lport == 0L || lport & ~0xffff) | |
144 | 144 | { |
145 | - if (!(sp = getservbyname(portname, "tcp"))) | |
145 | + if (!(sp = getservbyname(p->portname, "tcp"))) | |
146 | 146 | { |
147 | - snprintf(p->errmsg, p->em_len,_( "Unknown port number or service: %s" ),portname); | |
147 | + snprintf(p->errmsg, p->em_len,_( "Unknown port number or service: %s" ),p->portname); | |
148 | 148 | return -1; |
149 | 149 | } |
150 | 150 | port = sp->s_port; |
... | ... | @@ -153,17 +153,17 @@ static int cresolve_host_and_port(H3270 *h, struct parms *p) |
153 | 153 | { |
154 | 154 | port = htons((unsigned short)lport); |
155 | 155 | } |
156 | - *pport = ntohs(port); | |
156 | + *p->pport = ntohs(port); | |
157 | 157 | |
158 | 158 | /* Use gethostbyname() to resolve the hostname. */ |
159 | - hp = gethostbyname(host); | |
159 | + hp = gethostbyname(p->host); | |
160 | 160 | if (hp == (struct hostent *) 0) |
161 | 161 | { |
162 | 162 | sin->sin_family = AF_INET; |
163 | - sin->sin_addr.s_addr = inet_addr(host); | |
163 | + sin->sin_addr.s_addr = inet_addr(p->host); | |
164 | 164 | if (sin->sin_addr.s_addr == (unsigned long)-1) |
165 | 165 | { |
166 | - snprintf(p->errmsg, p->em_len, _( "Unknown host:\n%s" ), host); | |
166 | + snprintf(p->errmsg, p->em_len, _( "Unknown host:\n%s" ), p->host); | |
167 | 167 | return -2; |
168 | 168 | } |
169 | 169 | } |
... | ... | @@ -173,7 +173,7 @@ static int cresolve_host_and_port(H3270 *h, struct parms *p) |
173 | 173 | (void) memmove(&sin->sin_addr, hp->h_addr, hp->h_length); |
174 | 174 | } |
175 | 175 | sin->sin_port = port; |
176 | - *sa_len = sizeof(struct sockaddr_in); | |
176 | + *p->sa_len = sizeof(struct sockaddr_in); | |
177 | 177 | |
178 | 178 | #endif |
179 | 179 | ... | ... |