diff --git a/CHANGES b/CHANGES index aa8f41b4b0..f3f7c2c56f 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +2554. [func] dig: when emitting a hex dump also display the + corresponding characters. [RT #19258] + 2554. [bug] Validation of uppercase queries from NSEC3 zones could fail. [RT #19297] diff --git a/bin/dig/dighost.c b/bin/dig/dighost.c index 9fc6eccdfe..3621c8fea2 100644 --- a/bin/dig/dighost.c +++ b/bin/dig/dighost.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: dighost.c,v 1.318 2009/01/20 04:39:29 marka Exp $ */ +/* $Id: dighost.c,v 1.319 2009/02/16 00:01:37 marka Exp $ */ /*! \file * \note @@ -393,7 +393,7 @@ count_dots(char *string) { static void hex_dump(isc_buffer_t *b) { - unsigned int len; + unsigned int len, i; isc_region_t r; isc_buffer_usedregion(b, &r); @@ -401,11 +401,29 @@ hex_dump(isc_buffer_t *b) { printf("%d bytes\n", r.length); for (len = 0; len < r.length; len++) { printf("%02x ", r.base[len]); - if (len % 16 == 15) + if (len % 16 == 15) { + fputs(" ", stdout); + for (i = len - 15; i <= len; i++) { + if (r.base[i] >= '!' && r.base[i] <= '}') + putchar(r.base[i]); + else + putchar('.'); + } printf("\n"); + } } - if (len % 16 != 0) + if (len % 16 != 0) { + for (i = len; (i % 16) != 0; i++) + fputs(" ", stdout); + fputs(" ", stdout); + for (i = ((len>>4)<<4); i < len; i++) { + if (r.base[i] >= '!' && r.base[i] <= '}') + putchar(r.base[i]); + else + putchar('.'); + } printf("\n"); + } } /*%