From 0933575a5dc50bfa8a29cb3780a0c35b2789cfec Mon Sep 17 00:00:00 2001 From: James Golovich Date: Thu, 10 Jun 2004 06:51:01 +0000 Subject: [PATCH] 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 --- q931.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/q931.c b/q931.c index ac3a7de..af6c2c1 100755 --- a/q931.c +++ b/q931.c @@ -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) { int x; - pri_message("%c Display (len=%2d) [ ", prefix, ie->len); - for (x=0;xlen;x++) - pri_message("%c", ie->data[x] & 0x7f); - pri_message(" ]\n"); + char *buf = malloc(len + 1); + + if (buf) { + for (x=0; xlen; 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)