]> git.lizzy.rs Git - uwu-lang.git/blobdiff - common/err.h
Allow passing arguments to program, refactor directory structure
[uwu-lang.git] / common / err.h
diff --git a/common/err.h b/common/err.h
new file mode 100644 (file)
index 0000000..1dccbf9
--- /dev/null
@@ -0,0 +1,17 @@
+#ifndef _ERR_H_
+#define _ERR_H_
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+
+static inline void error(const char *format, ...)
+{
+       va_list args;
+       va_start(args, format);
+       vfprintf(stderr, format, args);
+       va_end(args);
+       exit(1);
+}
+
+#endif