From cd1e2a7b4a35d11176e1e054f33ecea35f951f44 Mon Sep 17 00:00:00 2001 From: Petr Vorel Date: Thu, 17 Aug 2023 17:55:15 +0200 Subject: [PATCH] DEBUG Signed-off-by: Petr Vorel --- ping/ping.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/ping/ping.c b/ping/ping.c index 27c72cad..bf1f732a 100644 --- a/ping/ping.c +++ b/ping/ping.c @@ -344,10 +344,12 @@ main(int argc, char **argv) #if defined(USE_IDN) || defined(ENABLE_NLS) setlocale(LC_ALL, ""); +/* #if defined(USE_IDN) if (!strcmp(setlocale(LC_ALL, NULL), "C")) hints.ai_flags &= ~ AI_CANONIDN; #endif +*/ #ifdef ENABLE_NLS bindtextdomain (PACKAGE_NAME, LOCALEDIR); textdomain (PACKAGE_NAME); @@ -654,6 +656,8 @@ main(int argc, char **argv) error(2, 0, "%s: %s", target, gai_strerror(ret_val)); for (ai = result; ai; ai = ai->ai_next) { + printf("ai->ai_family: %s, ai->ai_canonname: '%s'\n", + str_family(ai->ai_family), ai->ai_canonname); if (rts.opt_verbose) printf("ai->ai_family: %s, ai->ai_canonname: '%s'\n", str_family(ai->ai_family), @@ -785,8 +789,14 @@ int ping4_run(struct ping_rts *rts, int argc, char **argv, struct addrinfo *ai, memcpy(&rts->whereto, result->ai_addr, sizeof rts->whereto); memset(hnamebuf, 0, sizeof hnamebuf); - if (result->ai_canonname) + printf("target: '%s'\n", target); + if (result->ai_canonname) { strncpy(hnamebuf, result->ai_canonname, sizeof hnamebuf - 1); + printf("hnamebuf: '%s'\n", hnamebuf); + } else { + printf("hnamebuf will be empty!\n"); + } + rts->hostname = hnamebuf; if (argc > 1)