summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile8
-rw-r--r--ztscan.c24
2 files changed, 16 insertions, 16 deletions
diff --git a/Makefile b/Makefile
index dbbfea4..59b688b 100644
--- a/Makefile
+++ b/Makefile
@@ -321,15 +321,15 @@ gendigits: gendigits.c
prereq: config.status tones.h tor2fw.h radfw.h version.h
-zttool: zaptel.h
+zttool.o: zaptel.h
zttool: CFLAGS+=$(NEWT_INCLUDE)
zttool: LDLIBS+=$(NEWT_LIB)
-ztscan: zaptel.h
+ztscan.o: zaptel.h
-ztprovision: zaptel.h
+ztprovision.o: zaptel.h
-ztmonitor: zaptel.h
+ztmonitor.o: zaptel.h
ztspeed: CFLAGS=
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)