aboutsummaryrefslogtreecommitdiff
path: root/common/err.h
diff options
context:
space:
mode:
authorElias Fleckenstein <eliasfleckenstein@web.de>2021-12-30 21:53:01 +0100
committerElias Fleckenstein <eliasfleckenstein@web.de>2021-12-30 21:53:01 +0100
commitdd3da75c8d9da1f589ac6dded6140a4dc8d4b93f (patch)
treebe8534d2b8b1688e313a9703115721cdd12e0a3d /common/err.h
parenta454f9e1f2b09d4799e8ac3c4a4eb62bbba7b823 (diff)
downloaduwu-lang-dd3da75c8d9da1f589ac6dded6140a4dc8d4b93f.tar.xz
Unify error messages and checking
Diffstat (limited to 'common/err.h')
-rw-r--r--common/err.h10
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