summaryrefslogtreecommitdiff
path: root/src/util/err.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/err.h')
-rw-r--r--src/util/err.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/util/err.h b/src/util/err.h
new file mode 100644
index 0000000..52b3608
--- /dev/null
+++ b/src/util/err.h
@@ -0,0 +1,19 @@
+#ifndef ANIMTOOL_ERR_H
+#define ANIMTOOL_ERR_H
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+
+__attribute__((noreturn))
+__attribute__((format (printf, 1, 2)))
+static inline void eprintf(const char *fmt, ...)
+{
+ va_list args;
+ va_start(args, fmt);
+ vfprintf(stderr, fmt, args);
+ va_end(args);
+ exit(EXIT_FAILURE);
+}
+
+#endif