I came across a case where a file name contained a newline (decimal 10,
0x0A) character, so that opensc-explorer broke the line when displaying it:
OpenSC [3F00]> ls
FileID Type Size
0001 iEF 0
0003 iEF 0
2F00 wEF 250
[4100] DF 0 Name: \xE8(\xBD\x08\x0F
ACOPKCS-15
The attached patch changes the print_binary function so that everything
except printable characters (including space) are displayed in hex, thus:
OpenSC [3F00]> ls
FileID Type Size
0001 iEF 64
0003 iEF 384
2F00 wEF 250
[4100] DF 0 Name: \xE8(\xBD\x08\x0F\x0AACOPKCS-15
If that seems like a sensible change, can someone commit it please?
-- Ian
Index: src/tools/util.c
===================================================================
--- src/tools/util.c (revision 3312)
+++ src/tools/util.c (working copy)
@@ -99,7 +99,7 @@
for (i = 0; i < count; i++) {
unsigned char c = buf[i];
const char *format;
- if (!isalnum(c) && !ispunct(c) && !isspace(c))
+ if (!isprint(c))
format = "\\x%02X";
else
format = "%c";
_______________________________________________
opensc-devel mailing list
[email protected]
http://www.opensc-project.org/mailman/listinfo/opensc-devel