diff options
Diffstat (limited to 'rust/qmk-hid-com/src_c/src/error.c')
-rw-r--r-- | rust/qmk-hid-com/src_c/src/error.c | 20 |
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); +} |