From abd756ebad9ac1298b99e913e9ae2e102f5ed076 Mon Sep 17 00:00:00 2001 From: Mark Pizzolato Date: Thu, 3 Mar 2022 17:40:27 -0800 Subject: [PATCH] SCP: Allow unattached errors to halt with a specific unattached message --- scp.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/scp.c b/scp.c index 2fdc7816..d45f658d 100644 --- a/scp.c +++ b/scp.c @@ -11972,8 +11972,12 @@ do { (bare_reason != SCPE_STOP) && (bare_reason != SCPE_STEP) && (bare_reason != SCPE_RUNTIME) && - (bare_reason != SCPE_EXIT)) - sim_messagef (reason, "\nUnexpected internal error while processing event for %s which returned %d - %s\n", sim_uname (uptr), reason, sim_error_text (reason)); + (bare_reason != SCPE_EXIT)) { + if (bare_reason == SCPE_UNATT) + sim_messagef (reason, "\nUnexpected I/O error while processing event for %s - %s\n", sim_uname (uptr), sim_error_text (reason)); + else + sim_messagef (reason, "\nUnexpected internal error while processing event for %s which returned %d - %s\n", sim_uname (uptr), reason, sim_error_text (reason)); + } } while ((reason == SCPE_OK) && ((sim_interval + sim_interval_catchup) <= 0) && (sim_clock_queue != QUEUE_LIST_END) && @@ -13942,10 +13946,13 @@ va_list arglist; t_bool inhibit_message = (!sim_show_message || (stat & SCPE_NOMESSAGE)); char msg_prefix[32] = ""; size_t prefix_len; +t_bool newline_prefix = (*fmt == '\n'); if ((stat == SCPE_OK) && (sim_quiet || (sim_switches & SWMASK ('Q')))) return stat; -sprintf (msg_prefix, "%%SIM-%s: ", (stat == SCPE_OK) ? "INFO" : "ERROR"); +if (newline_prefix) + ++fmt; +sprintf (msg_prefix, "%s%%SIM-%s: ", newline_prefix ? (sim_is_running ? "\r\n" : "\n") : "", (stat == SCPE_OK) ? "INFO" : "ERROR"); prefix_len = strlen (msg_prefix); while (1) { /* format passed string, args */ va_start (arglist, fmt);