aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoriamcheeseman <[hidden email]>2026-03-01 11:10:54 -0500
committeriamcheeseman <[hidden email]>2026-03-01 11:10:54 -0500
commit998cb175da5fc8b95151f4e632e3024791e3196d (patch)
tree3a08682b9b6840f85ed6466efd6bc39369f396da
parent6d17f1ca1f4e2c85e8aed05e6902196f1274cf87 (diff)
bring code up to standards
-rw-r--r--src/bardata.c7
-rw-r--r--src/pipe.c17
-rw-r--r--src/pipe.h4
3 files changed, 15 insertions, 13 deletions
diff --git a/src/bardata.c b/src/bardata.c
index 3a4484c..73b0cc2 100644
--- a/src/bardata.c
+++ b/src/bardata.c
@@ -1,9 +1,10 @@
-#include <stdio.h>
-#include <string.h>
+#include "bardata.h"
+
#include <inttypes.h>
+#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
-#include "bardata.h"
#include "pipe.h"
int fontsize = 16;
diff --git a/src/pipe.c b/src/pipe.c
index 997be2d..9fc8406 100644
--- a/src/pipe.c
+++ b/src/pipe.c
@@ -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
diff --git a/src/pipe.h b/src/pipe.h
index e0e6301..233abf4 100644
--- a/src/pipe.h
+++ b/src/pipe.h
@@ -6,8 +6,8 @@
#define MAX_ARG_LEN 128
#define MAX_ARGS 16
-void init_pipe();
-void await_change();
+void init_pipe(void);
+void await_change(void);
void make_change(char[MAX_ARGS][MAX_ARG_LEN], int);
#endif