summaryrefslogtreecommitdiff
path: root/source/lib/util.c
diff options
context:
space:
mode:
authorSamba Release Account <samba-bugs@samba.org>1997-07-13 12:58:20 +0000
committerSamba Release Account <samba-bugs@samba.org>1997-07-13 12:58:20 +0000
commitdcb1a74cf11de0c02c640e4d683ac81a814db624 (patch)
tree4d6777ed0bf97af465534484067b79a73b14345d /source/lib/util.c
parent80a620dffaff2072ea33886f48e776b781283e30 (diff)
downloadsamba-dcb1a74cf11de0c02c640e4d683ac81a814db624.tar.gz
added pretty printing of data section to show_msg(), for debug log level 10.
data section output is now in same format as tcpdump (hex and characters). lkcl
Diffstat (limited to 'source/lib/util.c')
-rw-r--r--source/lib/util.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/source/lib/util.c b/source/lib/util.c
index f31ae390aa4..b7ad0bb5bce 100644
--- a/source/lib/util.c
+++ b/source/lib/util.c
@@ -995,6 +995,7 @@ void dos_format(char *fname)
void show_msg(char *buf)
{
int i;
+ int j;
int bcc=0;
if (DEBUGLEVEL < 5)
return;
@@ -1020,9 +1021,28 @@ void show_msg(char *buf)
DEBUG(5,("smb_bcc=%d\n",bcc));
if (DEBUGLEVEL < 10)
return;
- for (i=0;i<MIN(bcc,128);i++)
- DEBUG(10,("%X ",CVAL(smb_buf(buf),i)));
- DEBUG(10,("\n"));
+ for (i = 0; i < MIN(bcc, 256); i += 16)
+ {
+ for (j = 0; j < 16 && i+j < MIN(bcc,256); j++)
+ {
+
+ DEBUG(10,("%2X ",CVAL(smb_buf(buf),i+j)));
+ if (j == 7) DEBUG(10, (" "));
+
+ }
+ DEBUG(10,(" "));
+
+ for (j = 0; j < 16 && i+j < MIN(bcc,256); j++)
+ {
+ unsigned char c = CVAL(smb_buf(buf),i+j);
+ if (c < 32 || c > 128) c = '.';
+ DEBUG(10,("%c",c));
+
+ if (j == 7) DEBUG(10, (" "));
+ }
+
+ DEBUG(10,("\n"));
+ }
}
/*******************************************************************