summary refs log tree commit diff stats
path: root/rust/qmk-hid-com/src_c/src/error.c
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-12-30 18:22:41 +0100
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-12-30 18:22:41 +0100
commitba9f12810f7dc4969ac175f6e959d5fe6407747d (patch)
treef4039e46985d56bac471bd8568f96b159a92b2ae /rust/qmk-hid-com/src_c/src/error.c
parentfeat(src): Make usable (diff)
downloadqmk_layout-ba9f12810f7dc4969ac175f6e959d5fe6407747d.zip
feat(treewide): Migrate the Unicode handling to a custom c program, that works via rawhid
Diffstat (limited to 'rust/qmk-hid-com/src_c/src/error.c')
-rw-r--r--rust/qmk-hid-com/src_c/src/error.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/rust/qmk-hid-com/src_c/src/error.c b/rust/qmk-hid-com/src_c/src/error.c
new file mode 100644
index 0000000..f970cfc
--- /dev/null
+++ b/rust/qmk-hid-com/src_c/src/error.c
@@ -0,0 +1,20 @@
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <wayland-client.h>
+
+#include "error.h"
+
+__attribute__((noreturn)) __attribute__((format(printf, 1, 2))) void
+fail(const char *format, ...) {
+  va_list vas;
+
+  va_start(vas, format);
+  fprintf(stderr, "Error: ");
+  vfprintf(stderr, format, vas);
+  va_end(vas);
+
+  fprintf(stderr, "\n");
+
+  exit(EXIT_FAILURE);
+}