summary refs log tree commit diff
path: root/src/utils.c
diff options
context:
space:
mode:
authorNakidai <plaza521@inbox.ru>2024-07-05 00:04:56 +0300
committerNakidai <plaza521@inbox.ru>2024-07-05 00:04:56 +0300
commita9c159f5f7bf3479c3236735960597b4bc36a204 (patch)
treef325e249f11a4bb8518f01151114b1239207a33b /src/utils.c
download3cl-a9c159f5f7bf3479c3236735960597b4bc36a204.tar.gz
3cl-a9c159f5f7bf3479c3236735960597b4bc36a204.zip
Add code
Diffstat (limited to 'src/utils.c')
-rw-r--r--src/utils.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/utils.c b/src/utils.c
new file mode 100644
index 0000000..ee37110
--- /dev/null
+++ b/src/utils.c
@@ -0,0 +1,23 @@
+#include "utils.h"
+#include "types.h"
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdnoreturn.h>
+
+#include "main.h"
+
+
+noreturn void die(i32 code, s8 *fmt, ...)
+{
+    va_list args;
+
+    fprintf(stderr, "%s: ", program_name);
+
+    va_start(args, fmt);
+    vfprintf(stderr, fmt, args);
+    va_end(args);
+
+    exit(code);
+}