mirror of
https://github.com/cesanta/mongoose.git
synced 2024-11-25 03:29:00 +08:00
Using vnotify() for die()
This commit is contained in:
parent
ead098f726
commit
061ba99124
@ -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);
|
||||
|
||||
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) {
|
||||
|
Loading…
Reference in New Issue
Block a user