]> git.lizzy.rs Git - uwu-lang.git/blob - common/err.h
Redesign function names
[uwu-lang.git] / common / err.h
1 #ifndef _COMMON_ERR_H_
2 #define _COMMON_ERR_H_
3
4 #include <stdio.h>
5 #include <stdlib.h>
6 #include <stdarg.h>
7
8 static inline void error(const char *format, ...)
9 {
10         va_list args;
11         va_start(args, format);
12         vfprintf(stderr, format, args);
13         va_end(args);
14         exit(1);
15 }
16
17 static inline void syserror(const char *call, FILE *file)
18 {
19         perror(call);
20
21         if (file)
22                 fclose(file);
23
24         exit(1);
25 }
26
27 #endif