#include <fcntl.h>
#include <unistd.h>
#include <sys/time.h>

int
main(int argc, char **argv) {
	int fd, ret;
	struct timeval tv;
	fd_set fds;
	char buf[100];

	if((fd = __open("irctrl", O_RDWR /* | O_NONBLOCK */)) < 0) {
		perror("open()");
		return -1;
	}

	while(-1) {
		tv.tv_sec = 1;
		tv.tv_usec = 0;

		__select(0, 0, 0, 0, &tv);

		ret = __read(fd, buf, 100);
		if(ret > 0)	__write(1, buf, ret);
		else		__write(1, ".\n", 2);
	}
}
