summaryrefslogtreecommitdiff
path: root/global.c
diff options
context:
space:
mode:
Diffstat (limited to 'global.c')
-rw-r--r--global.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/global.c b/global.c
new file mode 100644
index 0000000..27f522c
--- /dev/null
+++ b/global.c
@@ -0,0 +1,16 @@
+#define _GNU_SOURCE
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include "global.h"
+
+__attribute__((noreturn, format (printf, 1, 2)))
+void throw(const char *format,...){
+ char *buf;
+ va_list ap;
+ va_start(ap,format);
+ vasprintf(&buf,format,ap);
+ va_end(ap);
+ fprintf(stderr,"THROW: %s\n",buf);
+ exit(1);
+}