From 8528151658927bcb4822f2956b93d352cf5ad2e6 Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Tue, 7 Nov 2006 19:05:43 +0000 Subject: small ipv6 doc changes; nslookup a tiny bit smaller --- networking/nc.c | 2 +- networking/nslookup.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'networking') diff --git a/networking/nc.c b/networking/nc.c index a940d8a5d..2f8a36bee 100644 --- a/networking/nc.c +++ b/networking/nc.c @@ -25,7 +25,6 @@ int nc_main(int argc, char **argv) SKIP_NC_EXTRA (const int execparam = 0;) USE_NC_EXTRA (char **execparam = NULL;) struct sockaddr_in address; - struct hostent *hostinfo; fd_set readfds, testfds; int opt; /* must be signed (getopt returns -1) */ @@ -116,6 +115,7 @@ int nc_main(int argc, char **argv) if (!execparam) close(sfd); } else { + struct hostent *hostinfo; hostinfo = xgethostbyname(argv[0]); address.sin_addr = *(struct in_addr *) *hostinfo->h_addr_list; diff --git a/networking/nslookup.c b/networking/nslookup.c index dd49e2669..89a2d6481 100644 --- a/networking/nslookup.c +++ b/networking/nslookup.c @@ -82,9 +82,10 @@ static int print_host(const char *hostname, const char *header) while (cur) { sockaddr_to_dotted(cur->ai_addr, str, sizeof(str)); printf("%s %s\nAddress: %s", header, hostname, str); - if (getnameinfo(cur->ai_addr, cur->ai_addrlen, str, sizeof(str), NULL, 0, NI_NAMEREQD)) + s[0] = ' '; + if (getnameinfo(cur->ai_addr, cur->ai_addrlen, str+1, sizeof(str)-1, NULL, 0, NI_NAMEREQD)) str[0] = '\0'; - printf(" %s\n", str); + puts(str); cur = cur->ai_next; } } else { -- cgit v1.2.3