1 #define _GNU_SOURCE /* asprintf */
10 /* Do we use syslog for messages or stderr? */
13 /* Do we want to silently drop all warnings? */
16 /* Number of times warn() has been called */
19 void message(const char *prefix
, const char *fmt
, va_list *arglist
)
24 ret
= vasprintf(&buf
, fmt
, *arglist
);
26 ret
= asprintf(&buf2
, "%s%s", prefix
, buf
);
29 buf2
= "FATAL: Out of memory.\n";
32 syslog(LOG_NOTICE
, "%s", buf2
);
34 fprintf(stderr
, "%s", buf2
);
43 void warn(const char *fmt
, ...)
47 va_start(arglist
, fmt
);
49 message("WARNING: ", fmt
, &arglist
);
53 void fatal(const char *fmt
, ...)
56 va_start(arglist
, fmt
);
57 message("FATAL: ", fmt
, &arglist
);