From 8986dda74a6ef4ca09655293a5b17b252279eec6 Mon Sep 17 00:00:00 2001 From: Yedaya Katsman Date: Sun, 16 Jun 2024 23:09:53 +0300 Subject: [PATCH 1/2] Remove extra newline from +yaml output The newlines weren't needed for the yaml syntax, and took up space. --- bin/dig/dig.c | 6 ++---- bin/tools/mdig.c | 3 +-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/bin/dig/dig.c b/bin/dig/dig.c index c98fa88277..61fcd61424 100644 --- a/bin/dig/dig.c +++ b/bin/dig/dig.c @@ -748,8 +748,7 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf, dns_message_t *msg, char *hash; int pf; - printf("-\n"); - printf(" type: MESSAGE\n"); + printf("- type: MESSAGE\n"); printf(" message:\n"); if (isquery) { @@ -3306,8 +3305,7 @@ dig_error(const char *format, ...) { va_list args; if (yaml) { - printf("-\n"); - printf(" type: DIG_ERROR\n"); + printf("- type: DIG_ERROR\n"); /* * Print an indent before a literal block quote. diff --git a/bin/tools/mdig.c b/bin/tools/mdig.c index 0270edb31b..5dadd55c11 100644 --- a/bin/tools/mdig.c +++ b/bin/tools/mdig.c @@ -297,8 +297,7 @@ recvresponse(void *arg) { char *hash; int pf; - printf("-\n"); - printf(" type: MESSAGE\n"); + printf("- type: MESSAGE\n"); printf(" message:\n"); if (((response->flags & DNS_MESSAGEFLAG_RD) != 0) && From 1dd76fe78051b926f2f7b614a40af550c6c6cdf2 Mon Sep 17 00:00:00 2001 From: Yedaya Katsman Date: Sun, 16 Jun 2024 23:10:28 +0300 Subject: [PATCH 2/2] Remove newlines from dighost errors calls Not all invocations had it, and this makes it more consistent with dighost_warning. Also remove the conditional newline when not outputting yaml --- bin/dig/dig.c | 5 +---- bin/dig/dighost.c | 10 +++++----- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/bin/dig/dig.c b/bin/dig/dig.c index 61fcd61424..e9665c9e01 100644 --- a/bin/dig/dig.c +++ b/bin/dig/dig.c @@ -3322,10 +3322,7 @@ dig_error(const char *format, ...) { va_start(args, format); vprintf(format, args); va_end(args); - - if (!yaml) { - printf("\n"); - } + printf("\n"); /* We get the error without a newline */ } static void diff --git a/bin/dig/dighost.c b/bin/dig/dighost.c index 1e2303a1af..001e3a46c8 100644 --- a/bin/dig/dighost.c +++ b/bin/dig/dighost.c @@ -3231,7 +3231,7 @@ udp_ready(isc_nmhandle_t *handle, isc_result_t eresult, void *arg) { start_udp(next); check_if_done(); } else { - dighost_error("no servers could be reached\n"); + dighost_error("no servers could be reached"); clear_current_lookup(); } @@ -3423,10 +3423,10 @@ force_next(dig_query_t *query) { isc_netaddr_fromsockaddr(&netaddr, &query->sockaddr); isc_netaddr_format(&netaddr, buf, sizeof(buf)); - dighost_error("no response from %s\n", buf); + dighost_error("no response from %s", buf); } else { printf("%s", l->cmdline); - dighost_error("no servers could be reached\n"); + dighost_error("no servers could be reached"); } if (exitcode < 9) { @@ -3650,7 +3650,7 @@ tcp_connected(isc_nmhandle_t *handle, isc_result_t eresult, void *arg) { start_tcp(next); check_if_done(); } else { - dighost_error("no servers could be reached\n"); + dighost_error("no servers could be reached"); clear_current_lookup(); } @@ -4103,7 +4103,7 @@ recv_done(isc_nmhandle_t *handle, isc_result_t eresult, isc_region_t *region, * and cancel the lookup. */ printf("%s", l->cmdline); - dighost_error("no servers could be reached\n"); + dighost_error("no servers could be reached"); if (exitcode < 9) { exitcode = 9;