1 #define _GNU_SOURCE /* asprintf */
10 /* Do we use syslog for messages or stderr? */
13 void message(const char *prefix
, const char *fmt
, va_list *arglist
)
17 vasprintf(&buf
, fmt
, *arglist
);
18 asprintf(&buf2
, "%s%s", prefix
, buf
);
21 syslog(LOG_NOTICE
, "%s", buf2
);
23 fprintf(stderr
, "%s", buf2
);
29 void warn(const char *fmt
, ...)
33 va_start(arglist
, fmt
);
34 message("WARNING: ", fmt
, &arglist
);
38 void fatal(const char *fmt
, ...)
41 va_start(arglist
, fmt
);
42 message("FATAL: ", fmt
, &arglist
);