1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-22 08:08:50 -05:00

use less code and prevent compiler warning

This commit is contained in:
Daniel Stenberg 2005-05-18 10:01:46 +00:00
parent fcc4518cdc
commit 8cb344bf3c

View File

@ -76,6 +76,7 @@ int main(int argc, char *argv[])
{ {
int arg=1; int arg=1;
char *host; char *host;
int rc;
while(argc>arg) { while(argc>arg) {
if(!strcmp("--version", argv[arg])) { if(!strcmp("--version", argv[arg])) {
@ -125,17 +126,13 @@ int main(int argc, char *argv[])
he = gethostbyname(host); he = gethostbyname(host);
if(!he) rc = !he;
printf("Resolving '%s' FAILED\n", host);
return he?0:1;
} }
#ifdef ENABLE_IPV6 #ifdef ENABLE_IPV6
else { else {
/* getaddrinfo() resolve */ /* getaddrinfo() resolve */
struct addrinfo *ai; struct addrinfo *ai;
struct addrinfo hints; struct addrinfo hints;
int rc;
memset(&hints, 0, sizeof(hints)); memset(&hints, 0, sizeof(hints));
hints.ai_family = PF_INET6; hints.ai_family = PF_INET6;
@ -143,12 +140,10 @@ int main(int argc, char *argv[])
hints.ai_flags = AI_CANONNAME; hints.ai_flags = AI_CANONNAME;
rc = (getaddrinfo)(host, "80", &hints, &ai); rc = (getaddrinfo)(host, "80", &hints, &ai);
if(rc)
printf("Resolving '%s' FAILED\n", host);
return !rc?0:1;
} }
#endif #endif
if(rc)
printf("Resolving '%s' FAILED\n", host);
return 0; return !rc?0:1;
} }