[Crash-utility] [PATCH] s390dbf: Print only ASCII characters in hex_ascii view

Michael Holzheu holzheu at linux.vnet.ibm.com
Tue Feb 14 11:54:07 UTC 2012


Hi Dave,

Currently the hex_ascii view displays also non ASCII characters. Example:

$ s390dbf test hex_ascii
00 01328703733:110640 1 - 01 0000000000114288  fb 63 ff fb fc | �c���

To make the output better readable we should only print ASCII characters.

Signed-off-by: Michael Holzheu <holzheu at linux.vnet.ibm.com>
---
 s390dbf.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

--- a/s390dbf.c
+++ b/s390dbf.c
@@ -419,10 +419,10 @@ hex_ascii_format_fn(debug_info_t * id, d
 	rc += sprintf(out_buf + rc, "| ");
 	for (i = 0; i < id->buf_size; i++) {
 		unsigned char c = in_buf[i];
-		if (!isprint(c))
-			rc += sprintf(out_buf + rc, ".");
-		else
+		if (isascii(c) && isprint(c))
 			rc += sprintf(out_buf + rc, "%c", c);
+		else
+			rc += sprintf(out_buf + rc, ".");
 	}
 	rc += sprintf(out_buf + rc, "\n");
       out:

-------------- next part --------------
A non-text attachment was scrubbed...
Name: crash-6.0.3-s390dbf-ascii.patch
Type: text/x-patch
Size: 971 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/crash-utility/attachments/20120214/a267b922/attachment.bin>


More information about the Crash-utility mailing list