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
)
18 ret
= vasprintf(&buf
, fmt
, *arglist
);
20 ret
= asprintf(&buf2
, "%s%s", prefix
, buf
);
23 buf2
= "FATAL: Out of memory.\n";
26 syslog(LOG_NOTICE
, "%s", buf2
);
28 fprintf(stderr
, "%s", buf2
);
38 void warn(const char *fmt
, ...)
42 va_start(arglist
, fmt
);
43 message("WARNING: ", fmt
, &arglist
);
47 void fatal(const char *fmt
, ...)
50 va_start(arglist
, fmt
);
51 message("FATAL: ", fmt
, &arglist
);