diff options
author | Elias Fleckenstein <eliasfleckenstein@web.de> | 2021-12-30 21:53:01 +0100 |
---|---|---|
committer | Elias Fleckenstein <eliasfleckenstein@web.de> | 2021-12-30 21:53:01 +0100 |
commit | dd3da75c8d9da1f589ac6dded6140a4dc8d4b93f (patch) | |
tree | be8534d2b8b1688e313a9703115721cdd12e0a3d /common/err.h | |
parent | a454f9e1f2b09d4799e8ac3c4a4eb62bbba7b823 (diff) | |
download | uwu-lang-dd3da75c8d9da1f589ac6dded6140a4dc8d4b93f.tar.xz |
Unify error messages and checking
Diffstat (limited to 'common/err.h')
-rw-r--r-- | common/err.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/common/err.h b/common/err.h index 34620bb..b9faf11 100644 --- a/common/err.h +++ b/common/err.h @@ -14,4 +14,14 @@ static inline void error(const char *format, ...) exit(1); } +static inline void syserror(const char *call, FILE *file) +{ + perror(call); + + if (file) + fclose(file); + + exit(1); +} + #endif |