From 126597c092570295aee73fede7c035dcceed4678 Mon Sep 17 00:00:00 2001 From: David Griffith Date: Fri, 28 Apr 2023 20:27:38 -0700 Subject: [PATCH] Added va_list support to curses os_fatal() - taken from os_warn(). --- src/curses/ux_init.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) 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; } -- 2.34.1