Skip to content

Commit

Permalink
DEBUG
Browse files Browse the repository at this point in the history
Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
  • Loading branch information
pevik committed Aug 17, 2023
1 parent b507113 commit cd1e2a7
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion ping/ping.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit cd1e2a7

Please sign in to comment.