[svn-commits] kpfleming: branch 1.4 r3290 - in /branches/1.4: Makefile ztscan.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Dec 4 11:41:52 CST 2007


Author: kpfleming
Date: Tue Dec  4 11:41:52 2007
New Revision: 3290

URL: http://svn.digium.com/view/zaptel?view=rev&rev=3290
Log:
fix a bunch of silly bugs and do some code cleanup

Modified:
    branches/1.4/Makefile
    branches/1.4/ztscan.c

Modified: branches/1.4/Makefile
URL: http://svn.digium.com/view/zaptel/branches/1.4/Makefile?view=diff&rev=3290&r1=3289&r2=3290
==============================================================================
--- branches/1.4/Makefile (original)
+++ branches/1.4/Makefile Tue Dec  4 11:41:52 2007
@@ -321,15 +321,15 @@
 
 prereq: config.status tones.h tor2fw.h radfw.h version.h
 
-zttool: zaptel.h
+zttool.o: zaptel.h
 zttool: CFLAGS+=$(NEWT_INCLUDE)
 zttool: LDLIBS+=$(NEWT_LIB)
 
-ztscan: zaptel.h
-
-ztprovision: zaptel.h
-
-ztmonitor: zaptel.h
+ztscan.o: zaptel.h
+
+ztprovision.o: zaptel.h
+
+ztmonitor.o: zaptel.h
 
 ztspeed: CFLAGS=
 

Modified: branches/1.4/ztscan.c
URL: http://svn.digium.com/view/zaptel/branches/1.4/ztscan.c?view=diff&rev=3290&r1=3289&r2=3290
==============================================================================
--- branches/1.4/ztscan.c (original)
+++ branches/1.4/ztscan.c Tue Dec  4 11:41:52 2007
@@ -43,7 +43,6 @@
 int main(int argc, char *argv[])
 {
 	int ctl;
-	int span = 0;
 	int x, y;
 	int hasgeneral = 0;
 	struct zt_params params;
@@ -61,8 +60,14 @@
 	for (x = 1; x < totalspans; x++) {
 		memset(&s, 0, sizeof(s));
 		s.spanno = x;
-		if (ioctl(ctl, ZT_SPANSTAT, s))
+		if (ioctl(ctl, ZT_SPANSTAT, &s))
 			continue;
+
+		if (!hasgeneral) {
+			fprintf(stdout, "[general]\ntotalspans=%d\n", s.totalspans);
+			hasgeneral++;
+			totalspans = s.totalspans;
+		}
 
 		alarms[0] = '\0';
 		if (s.alarms) {
@@ -91,12 +96,6 @@
 				strcpy(alarms, "UNCONFIGURED");
 		}
 
-		if (!hasgeneral) {
-			fprintf(stdout, "[general]\ntotalspans=%d\n", s.totalspans);
-			hasgeneral++;
-			totalspans = s.totalspans;
-		}
-
 		fprintf(stdout, "[%d]\n", x);
 		fprintf(stdout, "active=yes\n");
 		fprintf(stdout, "alarms=%s\n", alarms);
@@ -111,8 +110,11 @@
 		y = basechan;
 		memset(&params, 0, sizeof(params));
 		params.channo = y;
-		if (ioctl(ctl, ZT_GET_PARAMS, &params))
-			goto skip;
+		if (ioctl(ctl, ZT_GET_PARAMS, &params)) {
+			basechan += s.totalchans;
+			continue;
+		}
+
 		if (params.sigcap & __ZT_SIG_DACS) {
 			/* this is a digital span */
 			fprintf(stdout, "type=digital-%s\n", s.spantype);
@@ -169,9 +171,7 @@
 			}
 		}
 	  
-	skip:
 		basechan += s.totalchans;
-		span++;
 	}
 
 	if (!hasgeneral)




More information about the svn-commits mailing list