Skip to content
Snippets Groups Projects
Commit 061ba991 authored by Sergey Lyubka's avatar Sergey Lyubka
Browse files

Using vnotify() for die()

parent ead098f7
No related branches found
No related tags found
No related merge requests found
...@@ -97,17 +97,22 @@ static void __cdecl signal_handler(int sig_num) { ...@@ -97,17 +97,22 @@ static void __cdecl signal_handler(int sig_num) {
{ exit_flag = sig_num; } { exit_flag = sig_num; }
} }
static void die(const char *fmt, ...) { static void vnotify(const char *fmt, va_list ap, int must_exit) {
va_list ap;
char msg[200]; char msg[200];
va_start(ap, fmt);
vsnprintf(msg, sizeof(msg), fmt, ap); vsnprintf(msg, sizeof(msg), fmt, ap);
va_end(ap);
fprintf(stderr, "%s\n", msg); 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) { static void show_usage_and_exit(void) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment