diff options
author | Sean Bright <sean@malleable.com> | 2008-10-03 18:17:49 +0000 |
---|---|---|
committer | Sean Bright <sean@malleable.com> | 2008-10-03 18:17:49 +0000 |
commit | b9a4c9def1ecdf8af12d2c0aa8bf77804bf44e62 (patch) | |
tree | bb1d16ca75c244302b8bfaa9a9ade6136f184942 | |
parent | f145ad0c203bc4cace037e41489977e8e8255e41 (diff) |
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
git-svn-id: http://svn.asterisk.org/svn/dahdi/tools/trunk@5038 a0bf4364-ded3-4de4-8d8a-66a801d63aff
-rw-r--r-- | dahdi_scan.c | 23 | ||||
-rw-r--r-- | doc/dahdi_scan.8 | 4 |
2 files changed, 24 insertions, 3 deletions
diff --git a/dahdi_scan.c b/dahdi_scan.c index 63938f2..f844b41 100644 --- a/dahdi_scan.c +++ b/dahdi_scan.c @@ -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)) diff --git a/doc/dahdi_scan.8 b/doc/dahdi_scan.8 index 76b61b2..99514f9 100644 --- a/doc/dahdi_scan.8 +++ b/doc/dahdi_scan.8 @@ -24,11 +24,11 @@ dictionary. .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: |