aboutsummaryrefslogtreecommitdiff
path: root/include/errors.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/errors.h')
-rw-r--r--include/errors.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/include/errors.h b/include/errors.h
new file mode 100644
index 0000000..00fe6dc
--- /dev/null
+++ b/include/errors.h
@@ -0,0 +1,22 @@
+#ifndef MLIB_ERRORS_H
+#define MLIB_ERRORS_H
+
+#include <stdarg.h>
+
+void setprogname(const char *);
+
+[[gnu::format(printf, 1, 2)]] void warn(const char *, ...);
+[[gnu::format(printf, 1, 2)]] void warnx(const char *, ...);
+void vwarn(const char *, va_list);
+void vwarnx(const char *, va_list);
+
+[[noreturn, gnu::format(printf, 1, 2)]] void err(const char *, ...);
+[[noreturn, gnu::format(printf, 1, 2)]] void errx(const char *, ...);
+[[noreturn, gnu::format(printf, 2, 3)]] void cerr(int, const char *, ...);
+[[noreturn, gnu::format(printf, 2, 3)]] void cerrx(int, const char *, ...);
+
+extern const char *__mlib_errors_progname;
+
+#define progname() (__mlib_errors_progname)
+
+#endif /* !MLIB_ERRORS_H */