[PATCH 37/39] DDF: guid_str: more readable output

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Print ASCII characters as ASCII
---
 super-ddf.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/super-ddf.c b/super-ddf.c
index 1cb0a9f..428e8f3 100644
--- a/super-ddf.c
+++ b/super-ddf.c
@@ -1301,8 +1301,13 @@ static const char *guid_str(const char *guid)
 	static char buf[DDF_GUID_LEN*2+1];
 	int i;
 	char *p = buf;
-	for (i = 0; i < DDF_GUID_LEN; i++)
-		p += sprintf(p, "%02x", (unsigned char)guid[i]);
+	for (i = 0; i < DDF_GUID_LEN; i++) {
+		unsigned char c = guid[i];
+		if (c >= 32 && c < 127)
+			p += sprintf(p, "%c", c);
+		else
+			p += sprintf(p, "%02x", c);
+	}
 	*p = '\0';
 	return (const char *) buf;
 }
-- 
1.7.1
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux