[svn-commits] tzafrir: branch tzafrir/ztscan r4003 - /team/tzafrir/ztscan/ztscan.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Sun Mar 16 14:40:42 CDT 2008


Author: tzafrir
Date: Sun Mar 16 14:40:42 2008
New Revision: 4003

URL: http://svn.digium.com/view/zaptel?view=rev&rev=4003
Log:
While we shuffled that code, let's use nicer names.

Modified:
    team/tzafrir/ztscan/ztscan.c

Modified: team/tzafrir/ztscan/ztscan.c
URL: http://svn.digium.com/view/zaptel/team/tzafrir/ztscan/ztscan.c?view=diff&rev=4003&r1=4002&r2=4003
==============================================================================
--- team/tzafrir/ztscan/ztscan.c (original)
+++ team/tzafrir/ztscan/ztscan.c Sun Mar 16 14:40:42 2008
@@ -42,31 +42,31 @@
 
 void print_span(int spanno, int ctl)
 {
-	struct zt_spaninfo s;
+	struct zt_spaninfo spaninfo;
 	int y;
 	struct zt_params params;
 	unsigned int basechan = 1;
 	char buf[100];
 	char alarms[50];
 
-	memset(&s, 0, sizeof(s));
-	s.spanno = spanno;
-	if (ioctl(ctl, ZT_SPANSTAT, &s))
+	memset(&spaninfo, 0, sizeof(spaninfo));
+	spaninfo.spanno = spanno;
+	if (ioctl(ctl, ZT_SPANSTAT, &spaninfo))
 		return;
 
 	alarms[0] = '\0';
-	if (s.alarms) {
-		if (s.alarms & ZT_ALARM_BLUE)
+	if (spaninfo.alarms) {
+		if (spaninfo.alarms & ZT_ALARM_BLUE)
 			strcat(alarms,"BLU/");
-		if (s.alarms & ZT_ALARM_YELLOW)
+		if (spaninfo.alarms & ZT_ALARM_YELLOW)
 			strcat(alarms, "YEL/");
-		if (s.alarms & ZT_ALARM_RED)
+		if (spaninfo.alarms & ZT_ALARM_RED)
 			strcat(alarms, "RED/");
-		if (s.alarms & ZT_ALARM_LOOPBACK)
+		if (spaninfo.alarms & ZT_ALARM_LOOPBACK)
 			strcat(alarms,"LB/");
-		if (s.alarms & ZT_ALARM_RECOVER)
+		if (spaninfo.alarms & ZT_ALARM_RECOVER)
 			strcat(alarms,"REC/");
-		if (s.alarms & ZT_ALARM_NOTOPEN)
+		if (spaninfo.alarms & ZT_ALARM_NOTOPEN)
 			strcat(alarms, "NOP/");
 		if (!strlen(alarms))
 			strcat(alarms, "UUU/");
@@ -75,7 +75,7 @@
 			alarms[strlen(alarms)-1]='\0';
 		}
 	} else {
-		if (s.numchans)
+		if (spaninfo.numchans)
 			strcpy(alarms, "OK");
 		else
 			strcpy(alarms, "UNCONFIGURED");
@@ -84,57 +84,57 @@
 	fprintf(stdout, "[%d]\n", spanno);
 	fprintf(stdout, "active=yes\n");
 	fprintf(stdout, "alarms=%s\n", alarms);
-	fprintf(stdout, "description=%s\n", s.desc);
-	fprintf(stdout, "name=%s\n", s.name);
-	fprintf(stdout, "manufacturer=%s\n", s.manufacturer);
-	fprintf(stdout, "devicetype=%s\n", s.devicetype);
-	fprintf(stdout, "location=%s\n", s.location);
+	fprintf(stdout, "description=%s\n", spaninfo.desc);
+	fprintf(stdout, "name=%s\n", spaninfo.name);
+	fprintf(stdout, "manufacturer=%s\n", spaninfo.manufacturer);
+	fprintf(stdout, "devicetype=%s\n", spaninfo.devicetype);
+	fprintf(stdout, "location=%s\n", spaninfo.location);
 	fprintf(stdout, "basechan=%d\n", basechan);
-	fprintf(stdout, "totchans=%d\n", s.totalchans);
-	fprintf(stdout, "irq=%d\n", s.irq);
+	fprintf(stdout, "totchans=%d\n", spaninfo.totalchans);
+	fprintf(stdout, "irq=%d\n", spaninfo.irq);
 	y = basechan;
 	memset(&params, 0, sizeof(params));
 	params.channo = y;
 	if (ioctl(ctl, ZT_GET_PARAMS, &params)) {
-		basechan += s.totalchans;
+		basechan += spaninfo.totalchans;
 		return;
 	}
 
 	if (params.sigcap & (__ZT_SIG_DACS |  ZT_SIG_CAS)) {
 		/* this is a digital span */
-		fprintf(stdout, "type=digital-%s\n", s.spantype);
-		fprintf(stdout, "syncsrc=%d\n", s.syncsrc);
-		fprintf(stdout, "lbo=%s\n", s.lboname);
+		fprintf(stdout, "type=digital-%s\n", spaninfo.spantype);
+		fprintf(stdout, "syncsrc=%d\n", spaninfo.syncsrc);
+		fprintf(stdout, "lbo=%s\n", spaninfo.lboname);
 		fprintf(stdout, "coding_opts=");
 		buf[0] = '\0';
-		if (s.linecompat & ZT_CONFIG_B8ZS) strcat(buf, "B8ZS,");
-		if (s.linecompat & ZT_CONFIG_AMI) strcat(buf, "AMI,");
-		if (s.linecompat & ZT_CONFIG_HDB3) strcat(buf, "HDB3,");
+		if (spaninfo.linecompat & ZT_CONFIG_B8ZS) strcat(buf, "B8ZS,");
+		if (spaninfo.linecompat & ZT_CONFIG_AMI) strcat(buf, "AMI,");
+		if (spaninfo.linecompat & ZT_CONFIG_HDB3) strcat(buf, "HDB3,");
 		buf[strlen(buf) - 1] = '\0';
 		fprintf(stdout, "%s\n", buf);
 		fprintf(stdout, "framing_opts=");
 		buf[0] = '\0';
-		if (s.linecompat & ZT_CONFIG_ESF) strcat(buf, "ESF,");
-		if (s.linecompat & ZT_CONFIG_D4) strcat(buf, "D4,");
-		if (s.linecompat & ZT_CONFIG_CCS) strcat(buf, "CCS,");
-		if (s.linecompat & ZT_CONFIG_CRC4) strcat(buf, "CRC4,");
+		if (spaninfo.linecompat & ZT_CONFIG_ESF) strcat(buf, "ESF,");
+		if (spaninfo.linecompat & ZT_CONFIG_D4) strcat(buf, "D4,");
+		if (spaninfo.linecompat & ZT_CONFIG_CCS) strcat(buf, "CCS,");
+		if (spaninfo.linecompat & ZT_CONFIG_CRC4) strcat(buf, "CRC4,");
 		buf[strlen(buf) - 1] = '\0';
 		fprintf(stdout, "%s\n", buf);
 		fprintf(stdout, "coding=");
-		if (s.lineconfig & ZT_CONFIG_B8ZS) fprintf(stdout, "B8ZS");
-		else if (s.lineconfig & ZT_CONFIG_AMI) fprintf(stdout, "AMI");
-		else if (s.lineconfig & ZT_CONFIG_HDB3) fprintf(stdout, "HDB3");
+		if (spaninfo.lineconfig & ZT_CONFIG_B8ZS) fprintf(stdout, "B8ZS");
+		else if (spaninfo.lineconfig & ZT_CONFIG_AMI) fprintf(stdout, "AMI");
+		else if (spaninfo.lineconfig & ZT_CONFIG_HDB3) fprintf(stdout, "HDB3");
 		fprintf(stdout, "\n");
 		fprintf(stdout, "framing=");
-		if (s.lineconfig & ZT_CONFIG_ESF) fprintf(stdout, "ESF");
-		else if (s.lineconfig & ZT_CONFIG_D4) fprintf(stdout, "D4");
-		else if (s.lineconfig & ZT_CONFIG_CCS) fprintf(stdout, "CCS");
-		else if (s.lineconfig & ZT_CONFIG_CRC4) fprintf(stdout, "/CRC4");
+		if (spaninfo.lineconfig & ZT_CONFIG_ESF) fprintf(stdout, "ESF");
+		else if (spaninfo.lineconfig & ZT_CONFIG_D4) fprintf(stdout, "D4");
+		else if (spaninfo.lineconfig & ZT_CONFIG_CCS) fprintf(stdout, "CCS");
+		else if (spaninfo.lineconfig & ZT_CONFIG_CRC4) fprintf(stdout, "/CRC4");
 		fprintf(stdout, "\n");
 	} else {
 		/* this is an analog span */
 		fprintf(stdout, "type=analog\n");
-		for (y = basechan; y < (basechan + s.totalchans); y++) {
+		for (y = basechan; y < (basechan + spaninfo.totalchans); y++) {
 			memset(&params, 0, sizeof(params));
 			params.channo = y;
 			if (ioctl(ctl, ZT_GET_PARAMS, &params)) {
@@ -158,7 +158,7 @@
 		}
 	}
 
-	basechan += s.totalchans;
+	basechan += spaninfo.totalchans;
 }
 
 int main(int argc, char *argv[])




More information about the svn-commits mailing list