Format q921 log string before printing. Fixes those annoying half patch

packet decodes when logging data with something like script or tee


git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@84 2fbb986a-6c06-0410-b554-c9c1f0a7f128
This commit is contained in:
James Golovich
2004-04-05 08:22:14 +00:00
parent 480160c5cf
commit 949afd2385

12
q921.c
View File

@@ -494,10 +494,14 @@ void q921_dump(q921_h *h, int len, int showraw, int txrx)
direction_tag = txrx ? '>' : '<';
if (showraw) {
pri_message("\n%c [", direction_tag);
for (x=0;x<len;x++)
pri_message("%02x ",h->raw[x]);
pri_message("]\n");
char *buf = malloc(len * 3 + 1);
int buflen = 0;
if (buf) {
for (x=0;x<len;x++)
buflen += sprintf(buf + buflen, "%02x ", h->raw[x]);
pri_message("\n%c [ %s]\n", direction_tag, buf);
free(buf);
}
}
switch (h->h.data[0] & Q921_FRAMETYPE_MASK) {