[Asterisk-cvs] libpri q921.c,1.8,1.9

citats at lists.digium.com citats at lists.digium.com
Mon Apr 5 04:22:14 CDT 2004


Update of /usr/cvsroot/libpri
In directory mongoose.digium.com:/home/citats/cvs/libpri

Modified Files:
	q921.c 
Log Message:
Format q921 log string before printing.  Fixes those annoying half patch 
packet decodes when logging data with something like script or tee


Index: q921.c
===================================================================
RCS file: /usr/cvsroot/libpri/q921.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- q921.c	29 Mar 2004 08:09:01 -0000	1.8
+++ q921.c	5 Apr 2004 08:22:14 -0000	1.9
@@ -494,10 +494,14 @@
 	
 	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) {




More information about the svn-commits mailing list