Print response dict when there is one

This commit is contained in:
Willem Toorop 2015-10-31 17:59:14 +09:00
parent 521e46879b
commit fb6642d6a5
1 changed files with 10 additions and 9 deletions

View File

@ -491,16 +491,17 @@ void callback(getdns_context *context, getdns_callback_type_t callback_type,
{ {
char *response_str; char *response_str;
if (callback_type == GETDNS_CALLBACK_COMPLETE) { /* This is a callback with data */;
/* This is a callback with data */; if (response && !quiet && (response_str = json ?
if (!quiet && (response_str = json ? getdns_print_json_dict(response, json == 1)
getdns_print_json_dict(response, json == 1) : getdns_pretty_print_dict(response))) {
: getdns_pretty_print_dict(response))) {
fprintf(stdout, "ASYNC response:\n%s\n", response_str); fprintf(stdout, "ASYNC response:\n%s\n", response_str);
validate_chain(response); validate_chain(response);
free(response_str); free(response_str);
} }
if (callback_type == GETDNS_CALLBACK_COMPLETE) {
fprintf(stdout, fprintf(stdout,
"Response code was: GOOD. Status was: Callback with ID %llu was successfull.\n", "Response code was: GOOD. Status was: Callback with ID %llu was successfull.\n",
(unsigned long long)trans_id); (unsigned long long)trans_id);