Make q931.c:dump_display build the string first then print it in one command. Fixes remote console ugliness

git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@108 2fbb986a-6c06-0410-b554-c9c1f0a7f128
This commit is contained in:
James Golovich 2004-06-10 06:51:01 +00:00
parent 818a8cb57a
commit 0933575a5d

12
q931.c
View File

@ -1059,10 +1059,14 @@ static void dump_time_date(q931_ie *ie, int len, char prefix)
static void dump_display(q931_ie *ie, int len, char prefix) static void dump_display(q931_ie *ie, int len, char prefix)
{ {
int x; int x;
pri_message("%c Display (len=%2d) [ ", prefix, ie->len); char *buf = malloc(len + 1);
for (x=0;x<ie->len;x++)
pri_message("%c", ie->data[x] & 0x7f); if (buf) {
pri_message(" ]\n"); for (x=0; x<ie->len; x++)
sprintf(&buf[x], "%c", ie->data[x] & 0x7f);
pri_message("%c Display (len=%2d) [ %s ]\n", prefix, ie->len, buf);
free(buf);
}
} }
static void dump_ie_data(unsigned char *c, int len) static void dump_ie_data(unsigned char *c, int len)