diff options
author | markster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2002-10-22 22:59:02 +0000 |
---|---|---|
committer | markster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2002-10-22 22:59:02 +0000 |
commit | a4e2770c246e360b27c2a5dd45c3f50f8df6bf7f (patch) | |
tree | 32d4607caf59850a1945eacf6f81c0835c87d3b2 /ztdiag.c | |
parent | fc33a5b3eca25fa80cab3e8522be177f680cfeb2 (diff) |
Version 0.3.2 from FTP
git-svn-id: http://svn.digium.com/svn/zaptel/trunk@120 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'ztdiag.c')
-rwxr-xr-x | ztdiag.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/ztdiag.c b/ztdiag.c new file mode 100755 index 0000000..3db5b7f --- /dev/null +++ b/ztdiag.c @@ -0,0 +1,25 @@ +#include <sys/ioctl.h> +#include <linux/zaptel.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> + +int main(int argc, char *argv[]) +{ + int fd; + int chan; + if ((argc < 2) || (sscanf(argv[1], "%d", &chan) != 1)) { + fprintf(stderr, "Usage: ztdiag <channel>\n"); + exit(1); + } + fd = open("/dev/zap/ctl"); + if (fd < 0) { + perror("open(/dev/zap/ctl"); + exit(1); + } + if (ioctl(fd, ZT_CHANDIAG, &chan)) { + perror("ioctl(ZT_CHANDIAG)"); + exit(1); + } + exit(0); +} |