Some indentation changes in 86box.c and added a fatal_ex() function.
This commit is contained in:
55
src/86box.c
55
src/86box.c
@@ -218,21 +218,19 @@ pclog_ex(const char *fmt, va_list ap)
|
|||||||
stdlog = plat_fopen(log_path, "w");
|
stdlog = plat_fopen(log_path, "w");
|
||||||
if (stdlog == NULL)
|
if (stdlog == NULL)
|
||||||
stdlog = stdout;
|
stdlog = stdout;
|
||||||
} else {
|
} else
|
||||||
stdlog = stdout;
|
stdlog = stdout;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
vsprintf(temp, fmt, ap);
|
vsprintf(temp, fmt, ap);
|
||||||
if (suppr_seen && ! strcmp(buff, temp)) {
|
if (suppr_seen && ! strcmp(buff, temp))
|
||||||
seen++;
|
seen++;
|
||||||
} else {
|
else {
|
||||||
if (suppr_seen && seen) {
|
if (suppr_seen && seen)
|
||||||
fprintf(stdlog, "*** %d repeats ***\n", seen);
|
fprintf(stdlog, "*** %d repeats ***\n", seen);
|
||||||
}
|
|
||||||
seen = 0;
|
seen = 0;
|
||||||
strcpy(buff, temp);
|
strcpy(buff, temp);
|
||||||
fprintf(stdlog, temp, ap);
|
fprintf(stdlog, "%s", temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
fflush(stdlog);
|
fflush(stdlog);
|
||||||
@@ -278,10 +276,9 @@ fatal(const char *fmt, ...)
|
|||||||
stdlog = plat_fopen(log_path, "w");
|
stdlog = plat_fopen(log_path, "w");
|
||||||
if (stdlog == NULL)
|
if (stdlog == NULL)
|
||||||
stdlog = stdout;
|
stdlog = stdout;
|
||||||
} else {
|
} else
|
||||||
stdlog = stdout;
|
stdlog = stdout;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
vsprintf(temp, fmt, ap);
|
vsprintf(temp, fmt, ap);
|
||||||
fprintf(stdlog, "%s", temp);
|
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
|
#ifdef ENABLE_PC_LOG
|
||||||
int pc_do_log = ENABLE_PC_LOG;
|
int pc_do_log = ENABLE_PC_LOG;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user