14 static void errmsg(int prio, const char *prefix, const char *fmt, va_list args) {
15 fprintf(stderr, "%s: ", prefix);
16 vfprintf(stderr, fmt, args);
17 fprintf(stderr, "\n");
20 static void errmsgpe(int prio, const char *prefix, const char *fmt, va_list args) {
21 fprintf(stderr, "%s: ", prefix);
22 vfprintf(stderr, fmt, args);
23 fprintf(stderr, ": %s\n", strerror(errno));
26 NORETURN static void die(int prio, const char *prefix, const char *msg, va_list args) {
27 errmsg(prio, prefix, msg, args);
31 NORETURN static void diepe(int prio, const char *prefix, const char *msg, va_list args) {
32 errmsgpe(prio, prefix, msg, args);
36 NORETURN void fatal(const char *msg, ...) {
39 die(LOG_CRIT, "fatal", msg, args);
43 void error(const char *msg, ...) {
46 errmsg(LOG_ERR, "error", msg, args);
50 void warn(const char *msg, ...) {
53 errmsg(LOG_WARNING, "warning", msg, args);
57 void notice(const char *msg, ...) {
60 errmsg(LOG_NOTICE, "notice", msg, args);
64 void debug(const char *msg, ...) {
67 errmsg(LOG_DEBUG, "debug", msg, args);
71 NORETURN void deny(const char *msg, ...) {
74 die(LOG_ERR, "denied", msg, args);
78 NORETURN void badconf(const char *msg, ...) {
81 die(LOG_CRIT, "configuration error", msg, args);
85 NORETURN void fatalpe(const char *msg, ...) {
88 diepe(LOG_CRIT, "fatal", msg, args);
92 void errorpe(const char *msg, ...) {
95 errmsgpe(LOG_ERR, "error", msg, args);
99 void warnpe(const char *msg, ...) {
102 errmsgpe(LOG_WARNING, "warning", msg, args);