From 2249d061b83562443d0582e2f719e47d669ab5b4 Mon Sep 17 00:00:00 2001 From: dlukes <dlukes@4ea69e1a-61f1-4043-bf83-b5c94c648137> Date: Mon, 21 Dec 2009 21:05:52 +0000 Subject: [PATCH] -l gpllog,...: print text representation of data also (ticket #30) git-svn-id: https://smartmontools.svn.sourceforge.net/svnroot/smartmontools/trunk@3009 4ea69e1a-61f1-4043-bf83-b5c94c648137 --- smartmontools/CHANGELOG | 2 ++ smartmontools/ataprint.cpp | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/smartmontools/CHANGELOG b/smartmontools/CHANGELOG index b217deac9..f0b4a2af5 100644 --- a/smartmontools/CHANGELOG +++ b/smartmontools/CHANGELOG @@ -43,6 +43,8 @@ NOTES FOR FUTURE RELEASES: see TODO file. <DEVELOPERS: ADDITIONS TO THE CHANGE LOG GO JUST BELOW HERE, PLEASE> + [DL] -l gpllog,...: print text representation of data also (ticket #30) + [DL] FreeBSD: check reallocf() result for failures [AS] FreeBSD: fixing crash on kFreeBSD (#29), patch provided by Petr Salinger diff --git a/smartmontools/ataprint.cpp b/smartmontools/ataprint.cpp index 4bf3f6cfc..51fef8ac8 100644 --- a/smartmontools/ataprint.cpp +++ b/smartmontools/ataprint.cpp @@ -1016,10 +1016,16 @@ static void PrintLogPages(const char * type, const unsigned char * data, for (unsigned i = 0; i < num_pages * 512; i += 16) { const unsigned char * p = data+i; pout("%07x: %02x %02x %02x %02x %02x %02x %02x %02x " - "%02x %02x %02x %02x %02x %02x %02x %02x\n", + "%02x %02x %02x %02x %02x %02x %02x %02x ", (page * 512) + i, p[ 0], p[ 1], p[ 2], p[ 3], p[ 4], p[ 5], p[ 6], p[ 7], p[ 8], p[ 9], p[10], p[11], p[12], p[13], p[14], p[15]); +#define P(n) (isprint((int)(p[n]))?(int)(p[n]):'.') + pout("|%c%c%c%c%c%c%c%c" + "%c%c%c%c%c%c%c%c|\n", + P( 0), P( 1), P( 2), P( 3), P( 4), P( 5), P( 6), P( 7), + P( 8), P( 9), P(10), P(11), P(12), P(13), P(14), P(15)); +#undef P if ((i & 0x1ff) == 0x1f0) pout("\n"); } -- GitLab