rsmeter/util/checkrts.c

22 lines
431 B
C
Raw Normal View History

2004-10-19 16:48:03 -04:00
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
int main(int argc, char* argv[])
{
int stat, fd;
if(argc != 2) {
fprintf(stderr, "Usage %s <device>\n", argv[0]);
exit(-1);
}
fd = open(argv[1], O_RDONLY);
if(fd == -1) {
perror(argv[0]);
exit(1);
}
ioctl(fd, TIOCMGET, &stat);
if(stat & TIOCM_RTS) printf("Not asserted\n"); else printf("Asserted\n");
return 0;
}