[zaptel-commits] mattf: trunk r1655 - /trunk/zttool.c

zaptel-commits at lists.digium.com zaptel-commits at lists.digium.com
Tue Nov 28 15:43:09 MST 2006


Author: mattf
Date: Tue Nov 28 16:43:08 2006
New Revision: 1655

URL: http://svn.digium.com/view/zaptel?view=rev&rev=1655
Log:
Fix for #8300

Modified:
    trunk/zttool.c

Modified: trunk/zttool.c
URL: http://svn.digium.com/view/zaptel/trunk/zttool.c?view=diff&rev=1655&r1=1654&r2=1655
==============================================================================
--- trunk/zttool.c (original)
+++ trunk/zttool.c Tue Nov 28 16:43:08 2006
@@ -47,6 +47,7 @@
 #endif
 
 static int ctl = -1;
+static int span_max_chan_pos;
 
 static ZT_SPANINFO s[ZT_MAX_SPANS];
 
@@ -199,14 +200,14 @@
 	memset(tdbits,0, sizeof(tdbits));
 	memset(rcbits,0, sizeof(rcbits));
 	memset(rdbits,0, sizeof(rdbits));
-	memset(tabits,32, s[span].totalchans);
-	memset(tbbits,32, s[span].totalchans);
-	memset(rabits,32, s[span].totalchans);
-	memset(rbbits,32, s[span].totalchans);
-	memset(tcbits,32, s[span].totalchans);
-	memset(tdbits,32, s[span].totalchans);
-	memset(rcbits,32, s[span].totalchans);
-	memset(rdbits,32, s[span].totalchans);
+	memset(tabits,32, span_max_chan_pos);
+	memset(tbbits,32, span_max_chan_pos);
+	memset(rabits,32, span_max_chan_pos);
+	memset(rbbits,32, span_max_chan_pos);
+	memset(tcbits,32, span_max_chan_pos);
+	memset(tdbits,32, span_max_chan_pos);
+	memset(rcbits,32, span_max_chan_pos);
+	memset(rdbits,32, span_max_chan_pos);
 	
 	for (x=0;x<ZT_MAX_CHANNELS;x++) {
 		memset(&zp, 0, sizeof(zp));
@@ -337,9 +338,9 @@
 	newtComponent syncsrc;
 	newtComponent irqmisses;
 	
-	char s1[] = "         1111111111222222222333";
-	char s2[] = "1234567890123456789012345789012";
-	int max;
+	char s1[] = "         1111111111222222222233";
+	char s2[] = "1234567890123456789012345678901";
+	int x;
 	int looped = 0;
 	struct newtExitStruct es;
 
@@ -364,14 +365,24 @@
 
 	newtFormAddComponents(form, back, loop, NULL);
 
-	max = s[span].totalchans;
-	if (max > 32)
-		max = 32;
-
-	s1[max] = '\0';
-	s2[max] = '\0';
-
-	bitbox = newtTextbox(8,10,max,9,0);
+	span_max_chan_pos = s[span].totalchans;
+	for (x=0;x<ZT_MAX_CHANNELS;x++) {
+		ZT_PARAMS zp;
+		int res;
+		memset(&zp, 0, sizeof(zp));
+		zp.channo = x;
+		res = ioctl(ctl, ZT_GET_PARAMS, &zp);
+		if (!res && zp.spanno == span && zp.chanpos > span_max_chan_pos )
+			span_max_chan_pos = zp.chanpos;
+	}
+
+	if (span_max_chan_pos > 32)
+		span_max_chan_pos = 32;
+
+	s1[span_max_chan_pos] = '\0';
+	s2[span_max_chan_pos] = '\0';
+
+	bitbox = newtTextbox(8,10,span_max_chan_pos,9,0);
 	newtFormAddComponent(form, bitbox);
 
 	label = newtLabel(8,8,s1);
@@ -482,6 +493,7 @@
 	newtFormDestroy(form);
 	newtPopWindow();
 	newtPopHelpLine();
+	span_max_chan_pos = 0;
 }
 
 static void show_spans(void)



More information about the zaptel-commits mailing list