aboutsummaryrefslogtreecommitdiff
path: root/util.h
diff options
context:
space:
mode:
Diffstat (limited to 'util.h')
-rw-r--r--util.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/util.h b/util.h
new file mode 100644
index 0000000..d13dfae
--- /dev/null
+++ b/util.h
@@ -0,0 +1,17 @@
+#ifndef UTIL_H
+#define UTIL_H
+
+#include <stdio.h> // fprintf()
+#include <stdlib.h> // exit()
+
+#define MAX(a, b) ((a) > (b) ? (a) : (b))
+#define UNUSED(a) ((void) (a))
+
+#define die(...) do { \
+ fputs("FATAL: ", stderr); \
+ fprintf(stderr, __VA_ARGS__); \
+ fputs("\n", stderr); \
+ exit(EXIT_FAILURE); \
+} while (0)
+
+#endif /* UTIL_H */