Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Crash Utility (http://www.linux-archive.org/crash-utility/)
-   -   s390dbf: Print only ASCII characters in hex_ascii view (http://www.linux-archive.org/crash-utility/632736-s390dbf-print-only-ascii-characters-hex_ascii-view.html)

Michael Holzheu 02-14-2012 10:54 AM

s390dbf: Print only ASCII characters in hex_ascii view
 
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@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, "
");
out:

--
Crash-utility mailing list
Crash-utility@redhat.com
https://www.redhat.com/mailman/listinfo/crash-utility


All times are GMT. The time now is 03:55 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.