summaryrefslogtreecommitdiff
path: root/debug.c
diff options
context:
space:
mode:
Diffstat (limited to 'debug.c')
-rw-r--r--debug.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/debug.c b/debug.c
new file mode 100644
index 0000000..81d173c
--- /dev/null
+++ b/debug.c
@@ -0,0 +1,18 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+
+#include "debug.h"
+
+void
+_error(const char *file, const int line, const char *fmt, ...)
+{
+ va_list args;
+ fprintf(stderr, "%s:%d: ", file, line);
+
+ va_start(args, fmt);
+ vfprintf(stderr, fmt, args);
+ va_end(args);
+
+ exit(1);
+}