summaryrefslogtreecommitdiff
path: root/dahdi_scan.c
diff options
context:
space:
mode:
authorSean Bright <sean@malleable.com>2008-10-03 18:17:49 +0000
committerSean Bright <sean@malleable.com>2008-10-03 18:17:49 +0000
commitb9a4c9def1ecdf8af12d2c0aa8bf77804bf44e62 (patch)
treebb1d16ca75c244302b8bfaa9a9ade6136f184942 /dahdi_scan.c
parentf145ad0c203bc4cace037e41489977e8e8255e41 (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
Diffstat (limited to 'dahdi_scan.c')
-rw-r--r--dahdi_scan.c23
1 files changed, 22 insertions, 1 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))