From: David Griffith Date: Sat, 29 Apr 2023 03:27:38 +0000 (-0700) Subject: Added va_list support to curses os_fatal() - taken from os_warn(). X-Git-Url: https://scope-eye.net/git/?a=commitdiff_plain;h=126597c092570295aee73fede7c035dcceed4678;p=liskon_frotz.git Added va_list support to curses os_fatal() - taken from os_warn(). --- diff --git a/src/curses/ux_init.c b/src/curses/ux_init.c index 7d810d1..5dcefa0 100644 --- a/src/curses/ux_init.c +++ b/src/curses/ux_init.c @@ -156,14 +156,23 @@ void os_warn (const char *s, ...) */ void os_fatal (const char *s, ...) { + va_list m; + char errorstring[81]; + int style; + + va_start(m, s); + vsnprintf(errorstring, sizeof(char) * 80, s, m); + va_end(m); + if (u_setup.curses_active) { /* Solaris 2.6's cc complains if the below cast is missing */ print_c_string("\n\n"); os_beep(BEEP_HIGH); + style = u_setup.current_text_style; os_set_text_style(BOLDFACE_STYLE); print_c_string("Fatal error: "); - os_set_text_style(0); - print_c_string(s); + os_set_text_style(style); + print_c_string(errorstring); print_c_string("\n"); new_line(); if (f_setup.ignore_errors) { @@ -182,9 +191,9 @@ void os_fatal (const char *s, ...) } fputs ("\nFatal error: ", stderr); - fputs (s, stderr); + fputs (errorstring, stderr); if (f_setup.ignore_errors) { - fputs ("\n\rContinuing anyway", stderr); + fputs ("\n\rContinuing anyway...", stderr); return; }