void dump_hex( const unsigned char *buf, int len)
{
int i;
int nlocal;
const unsigned char *pc;
char *out;
const unsigned char *start;
char c;
char line[100];
start = buf;
while (len > 0)
{
sprintf(line, "%08x: ", buf - start);
out = line + 10;
for (i = 0, pc = buf, nlocal = len; i < 16; i++, pc++)
{
if (nlocal > 0)
{
c = *pc;
*out++ = NIBBLE((c >> 4) & 0xF);
*out++ = NIBBLE(c & 0xF);
nlocal--;
}
else
{
*out++ = ' ';
*out++ = ' ';
} /* end else */
*out++ = ' ';
} /* end for */
*out++ = '-';
*out++ = ' ';
for (i = 0, pc = buf, nlocal = len;
(i < 16) && (nlocal > 0);
i++, pc++, nlocal--)
{
c = *pc;
if ((c < ' ') || (c >= 126))
{
c = '.';
}
*out++ = c;
} /* end for */
*out++ = 0;
llog(L_NOTICE,"%s", line);
buf += 16;
len -= 16;
} /* end while */
} /* end dump */
{
int i;
int nlocal;
const unsigned char *pc;
char *out;
const unsigned char *start;
char c;
char line[100];
start = buf;
while (len > 0)
{
sprintf(line, "%08x: ", buf - start);
out = line + 10;
for (i = 0, pc = buf, nlocal = len; i < 16; i++, pc++)
{
if (nlocal > 0)
{
c = *pc;
*out++ = NIBBLE((c >> 4) & 0xF);
*out++ = NIBBLE(c & 0xF);
nlocal--;
}
else
{
*out++ = ' ';
*out++ = ' ';
} /* end else */
*out++ = ' ';
} /* end for */
*out++ = '-';
*out++ = ' ';
for (i = 0, pc = buf, nlocal = len;
(i < 16) && (nlocal > 0);
i++, pc++, nlocal--)
{
c = *pc;
if ((c < ' ') || (c >= 126))
{
c = '.';
}
*out++ = c;
} /* end for */
*out++ = 0;
llog(L_NOTICE,"%s", line);
buf += 16;
len -= 16;
} /* end while */
} /* end dump */