aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2005-05-18 10:01:46 +0000
committerDaniel Stenberg <daniel@haxx.se>2005-05-18 10:01:46 +0000
commit8cb344bf3cbd5886ff714bcc8af0cf7d0b7c79c0 (patch)
tree212eabdf41a1c8f865ed80dbffe53aa2dd144e6b
parentfcc4518cdcfd56b4d62010783081b36b2ab34193 (diff)
use less code and prevent compiler warning
-rw-r--r--tests/server/resolve.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/tests/server/resolve.c b/tests/server/resolve.c
index 84b369e6b..e0a4e1666 100644
--- a/tests/server/resolve.c
+++ b/tests/server/resolve.c
@@ -76,6 +76,7 @@ int main(int argc, char *argv[])
{
int arg=1;
char *host;
+ int rc;
while(argc>arg) {
if(!strcmp("--version", argv[arg])) {
@@ -125,17 +126,13 @@ int main(int argc, char *argv[])
he = gethostbyname(host);
- if(!he)
- printf("Resolving '%s' FAILED\n", host);
-
- return he?0:1;
+ rc = !he;
}
#ifdef ENABLE_IPV6
else {
/* getaddrinfo() resolve */
struct addrinfo *ai;
struct addrinfo hints;
- int rc;
memset(&hints, 0, sizeof(hints));
hints.ai_family = PF_INET6;
@@ -143,12 +140,10 @@ int main(int argc, char *argv[])
hints.ai_flags = AI_CANONNAME;
rc = (getaddrinfo)(host, "80", &hints, &ai);
- if(rc)
- printf("Resolving '%s' FAILED\n", host);
-
- return !rc?0:1;
}
#endif
+ if(rc)
+ printf("Resolving '%s' FAILED\n", host);
- return 0;
+ return !rc?0:1;
}