}
void
-read_error(Fifo *f, char *buf)
+fifo_read_error(Fifo *f, char *buf)
{
char *b;
int i;
}
void
-read_one(Fifo *f, char *buf)
+fifo_read_one(Fifo *f, char *buf)
{
ssize_t current;
ssize_t total;
*b++ = c;
if (current == -1) {
error("Failed to read: \"%s\". Error: %s\n", f->name, strerror(errno));
- read_error(f, buf);
+ fifo_read_error(f, buf);
}
/* TODO Record timestamp read */
close(f->fd);
}
void
-read_all(Config *cfg, char *buf)
+fifo_read_all(Config *cfg, char *buf)
{
fd_set fds;
int maxfd = -1;
/* TODO: Create the FIFO if it doesn't already exist. */
if (lstat(f->name, &st) < 0) {
error("Cannot stat \"%s\". Error: %s\n", f->name, strerror(errno));
- read_error(f, buf);
+ fifo_read_error(f, buf);
continue;
}
if (!(st.st_mode & S_IFIFO)) {
error("\"%s\" is not a FIFO\n", f->name);
- read_error(f, buf);
+ fifo_read_error(f, buf);
continue;
}
debug("opening: %s\n", f->name);
if (f->fd == -1) {
/* TODO: Consider backing off retries for failed fifos. */
error("Failed to open \"%s\"\n", f->name);
- read_error(f, buf);
+ fifo_read_error(f, buf);
continue;
}
if (f->fd > maxfd)
for (Fifo *f = cfg->fifos; f; f = f->next) {
if (FD_ISSET(f->fd, &fds)) {
debug("reading: %s\n", f->name);
- read_one(f, buf);
+ fifo_read_one(f, buf);
}
}
}
for (;;) {
/* TODO: Check TTL and maybe blank-out */
/* TODO: How to trigger TTL check? On select? Alarm signal? */
- /* TODO: Set timeout on read_all based on diff of last time of
- * read_all and desired time of next TTL check.
+ /* TODO: Set timeout on fifo_read_all based on diff of last time of
+ * fifo_read_all and desired time of next TTL check.
* */
- read_all(cfg, buf);
+ fifo_read_all(cfg, buf);
if (cfg->output_to_x_root_window) {
if (XStoreName(display, DefaultRootWindow(display), buf) < 0)
fatal("XStoreName failed.\n");