[svn-commits] seanbright: tools/trunk r5038 - in /tools/trunk: dahdi_scan.c doc/dahdi_scan.8

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Oct 3 13:17:49 CDT 2008


Author: seanbright
Date: Fri Oct  3 13:17:49 2008
New Revision: 5038

URL: http://svn.digium.com/view/dahdi?view=rev&rev=5038
Log:
Fix the dahdi_scan manpage (s/dahdi_span/dahdi_scan/) and make dahdi_scan do
what it is advertised to do.  Namely take span numbers on the command line.

(closes issue #13614)
Reported by: jfinstrom

Modified:
    tools/trunk/dahdi_scan.c
    tools/trunk/doc/dahdi_scan.8

Modified: tools/trunk/dahdi_scan.c
URL: http://svn.digium.com/view/dahdi/tools/trunk/dahdi_scan.c?view=diff&rev=5038&r1=5037&r2=5038
==============================================================================
--- tools/trunk/dahdi_scan.c (original)
+++ tools/trunk/dahdi_scan.c Fri Oct  3 13:17:49 2008
@@ -40,19 +40,40 @@
 int main(int argc, char *argv[])
 {
 	int ctl;
-	int x, y;
+	int x, y, z;
 	struct dahdi_params params;
 	unsigned int basechan = 1;
 	struct dahdi_spaninfo s;
 	char buf[100];
 	char alarms[50];
+	int filter_count = 0;
+	int span_filter[DAHDI_MAX_SPANS];
 
 	if ((ctl = open("/dev/dahdi/ctl", O_RDWR)) < 0) {
 		fprintf(stderr, "Unable to open /dev/dahdi/ctl: %s\n", strerror(errno));
 		exit(1);
 	}
+
+	for (x = 1; x < argc && filter_count < DAHDI_MAX_SPANS; x++) {
+		int s = atoi(argv[x]);
+		if (s > 0) {
+			span_filter[filter_count++] = s;
+		}
+	}
 	
 	for (x = 1; x < DAHDI_MAX_SPANS; x++) {
+		if (filter_count > 0) {
+			int match = 0;
+			for (z = 0; z < filter_count; z++) {
+				if (x == span_filter[z]) {
+					match = 1;
+					break;
+				}
+			}
+			if (!match) {
+				continue;
+			}
+		}
 		memset(&s, 0, sizeof(s));
 		s.spanno = x;
 		if (ioctl(ctl, DAHDI_SPANSTAT, &s))

Modified: tools/trunk/doc/dahdi_scan.8
URL: http://svn.digium.com/view/dahdi/tools/trunk/doc/dahdi_scan.8?view=diff&rev=5038&r1=5037&r2=5038
==============================================================================
--- tools/trunk/doc/dahdi_scan.8 (original)
+++ tools/trunk/doc/dahdi_scan.8 Fri Oct  3 13:17:49 2008
@@ -24,11 +24,11 @@
 .SH EXAMPLES
 Printing information for spans 1, 2 and 4:
 
-  dahdi_span 1 2 4
+  dahdi_scan 1 2 4
 
 And to print all the spans:
 
-  dahdi_span
+  dahdi_scan
 
 Information about a certain analog span:
 




More information about the svn-commits mailing list