From 56caeb540795fb92f3289bbc4744e94da0c20654 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Sun, 2 Jan 2022 11:53:21 +0100 Subject: Turn common back into a normal directory (instead of a submodule) --- common/err.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 common/err.h (limited to 'common/err.h') diff --git a/common/err.h b/common/err.h new file mode 100644 index 0000000..9db3e23 --- /dev/null +++ b/common/err.h @@ -0,0 +1,27 @@ +#ifndef _UWU_COMMON_ERR_H_ +#define _UWU_COMMON_ERR_H_ + +#include +#include +#include + +static inline void error(const char *format, ...) +{ + va_list args; + va_start(args, format); + vfprintf(stderr, format, args); + va_end(args); + exit(1); +} + +static inline void syserror(const char *call, FILE *file) +{ + perror(call); + + if (file) + fclose(file); + + exit(1); +} + +#endif -- cgit v1.2.3