summaryrefslogtreecommitdiff
path: root/ztscan.c
diff options
context:
space:
mode:
authorkpfleming <kpfleming@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2007-12-04 17:41:52 +0000
committerkpfleming <kpfleming@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2007-12-04 17:41:52 +0000
commit3dbc15f0ecbfd225b5b05bb1c66524b82e21380f (patch)
tree398b762128a94b9760c0920af1072b6efd5127f7 /ztscan.c
parent35be5105b6a4cbf3a530764c935d12c44f9d3cf8 (diff)
fix a bunch of silly bugs and do some code cleanup
git-svn-id: http://svn.digium.com/svn/zaptel/branches/1.4@3290 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'ztscan.c')
-rw-r--r--ztscan.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/ztscan.c b/ztscan.c
index 48316b1..dbad8f4 100644
--- a/ztscan.c
+++ b/ztscan.c
@@ -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,9 +60,15 @@ int main(int argc, char *argv[])
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) {
if (s.alarms & ZT_ALARM_BLUE)
@@ -91,12 +96,6 @@ int main(int argc, char *argv[])
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 @@ int main(int argc, char *argv[])
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 @@ int main(int argc, char *argv[])
}
}
- skip:
basechan += s.totalchans;
- span++;
}
if (!hasgeneral)