divide main.c into multiple modules

This commit is contained in:
2025-03-20 10:56:10 +01:00
parent 99cb3398bf
commit b017f503eb
7 changed files with 126 additions and 89 deletions

18
src/error.c Normal file
View File

@@ -0,0 +1,18 @@
#include "error.h"
#include <stdarg.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdnoreturn.h>
noreturn void fatal(char const* fmt, ...) {
char buf[128];
va_list args;
va_start(args, fmt);
vsnprintf(buf, 128, fmt, args);
va_end(args);
fprintf(stderr, "\033[91mE: %s\033[0m\n", buf);
exit(1);
}