Some indentation changes in 86box.c and added a fatal_ex() function.

This commit is contained in:
OBattler
2021-06-07 00:15:09 +02:00
parent f0da82fa2b
commit 63a5c3a281

View File

@@ -218,21 +218,19 @@ pclog_ex(const char *fmt, va_list ap)
stdlog = plat_fopen(log_path, "w");
if (stdlog == NULL)
stdlog = stdout;
} else {
} else
stdlog = stdout;
}
}
vsprintf(temp, fmt, ap);
if (suppr_seen && ! strcmp(buff, temp)) {
if (suppr_seen && ! strcmp(buff, temp))
seen++;
} else {
if (suppr_seen && seen) {
else {
if (suppr_seen && seen)
fprintf(stdlog, "*** %d repeats ***\n", seen);
}
seen = 0;
strcpy(buff, temp);
fprintf(stdlog, temp, ap);
fprintf(stdlog, "%s", temp);
}
fflush(stdlog);
@@ -278,10 +276,9 @@ fatal(const char *fmt, ...)
stdlog = plat_fopen(log_path, "w");
if (stdlog == NULL)
stdlog = stdout;
} else {
} else
stdlog = stdout;
}
}
vsprintf(temp, fmt, ap);
fprintf(stdlog, "%s", temp);
@@ -311,6 +308,46 @@ fatal(const char *fmt, ...)
}
void
fatal_ex(const char *fmt, va_list ap)
{
char temp[1024];
char *sp;
if (stdlog == NULL) {
if (log_path[0] != '\0') {
stdlog = plat_fopen(log_path, "w");
if (stdlog == NULL)
stdlog = stdout;
} else
stdlog = stdout;
}
vsprintf(temp, fmt, ap);
fprintf(stdlog, "%s", temp);
fflush(stdlog);
nvr_save();
config_save();
#ifdef ENABLE_808X_LOG
dumpregs(1);
#endif
/* Make sure the message does not have a trailing newline. */
if ((sp = strchr(temp, '\n')) != NULL) *sp = '\0';
/* Cleanly terminate all of the emulator's components so as
to avoid things like threads getting stuck. */
do_stop();
ui_msgbox(MBX_ERROR | MBX_FATAL | MBX_ANSI, temp);
fflush(stdlog);
}
#ifdef ENABLE_PC_LOG
int pc_do_log = ENABLE_PC_LOG;