diff options
Diffstat (limited to 'src/pipe.c')
| -rw-r--r-- | src/pipe.c | 17 |
1 files changed, 9 insertions, 8 deletions
@@ -1,24 +1,25 @@ +#include "pipe.h" -#include <stdio.h> +#include <ctype.h> #include <fcntl.h> -#include <unistd.h> -#include <sys/stat.h> +#include <stdbool.h> +#include <stdio.h> #include <string.h> -#include <ctype.h> +#include <sys/stat.h> +#include <unistd.h> -#include "pipe.h" #include "bardata.h" FILE *named_pipe; -void init_pipe() { +void init_pipe(void) { mkfifo(PIPE_PATH, 0666); named_pipe = fopen(PIPE_PATH, "r"); } -void await_change() { +void await_change(void) { char buff[1024]; - while (1) { + while (true) { if (!fgets(buff, sizeof(buff), named_pipe)) { fclose(named_pipe); named_pipe = fopen(PIPE_PATH, "r"); // This blocks, 0% CPU, yay |
