diff options
Diffstat (limited to 'src/utils.c')
| -rw-r--r-- | src/utils.c | 23 |
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); +} |