core: At debug levels up to 9 print only an ascii dump.
* src/debug.c (_gpgme_debug_buffer): Switch between two output formats. -- The new format is much more practical than the bunch of hex digits followed by just 16 ascii chars. To get the old behaviour use a debug level of 10. Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
2a3cdb3e81
commit
3b32f7a97f
32
src/debug.c
32
src/debug.c
@ -403,6 +403,8 @@ _gpgme_debug_buffer (int lvl, const char *const fmt,
|
||||
if (!buffer)
|
||||
return;
|
||||
|
||||
if (lvl > 9)
|
||||
{
|
||||
while (idx < len)
|
||||
{
|
||||
char str[51];
|
||||
@ -433,3 +435,33 @@ _gpgme_debug_buffer (int lvl, const char *const fmt,
|
||||
_gpgme_debug (NULL, lvl, -1, NULL, NULL, NULL, fmt, func, str);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while (idx < len)
|
||||
{
|
||||
char str[48+4+1];
|
||||
char *strp = str;
|
||||
|
||||
for (j = 0; j < 48; j++)
|
||||
{
|
||||
unsigned char val;
|
||||
if (idx < len)
|
||||
{
|
||||
val = buffer[idx++];
|
||||
if (val == '\n')
|
||||
{
|
||||
*strp++ = '<';
|
||||
*strp++ = 'L';
|
||||
*strp++ = 'F';
|
||||
*strp++ = '>';
|
||||
break;
|
||||
}
|
||||
*strp++ = (val > 31 && val < 127)? val : '.';
|
||||
}
|
||||
}
|
||||
*strp = 0;
|
||||
|
||||
_gpgme_debug (NULL, lvl, -1, NULL, NULL, NULL, fmt, func, str);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user