Using vnotify() for die()

This commit is contained in:
Sergey Lyubka 2014-01-20 08:54:06 +00:00
parent ead098f726
commit 061ba99124

View File

@ -97,17 +97,22 @@ static void __cdecl signal_handler(int sig_num) {
{ exit_flag = sig_num; }
}
static void die(const char *fmt, ...) {
va_list ap;
static void vnotify(const char *fmt, va_list ap, int must_exit) {
char msg[200];
va_start(ap, fmt);
vsnprintf(msg, sizeof(msg), fmt, ap);
va_end(ap);
fprintf(stderr, "%s\n", msg);
exit(EXIT_FAILURE);
if (must_exit) {
exit(EXIT_FAILURE);
}
}
static void die(const char *fmt, ...) {
va_list ap;
va_start(ap, fmt);
vnotify(fmt, ap, 1);
va_end(ap);
}
static void show_usage_and_exit(void) {