diff --git a/qbsp/qbsp.h b/qbsp/qbsp.h index 9bc44ff1..37ad4708 100644 --- a/qbsp/qbsp.h +++ b/qbsp/qbsp.h @@ -683,6 +683,8 @@ extern void PrintMem(void); extern void Message(int MsgType, ...); extern void Error(int ErrType, ...) __attribute__((noreturn)); +extern void Error_(const char *error, ...) + __attribute__((format(printf,1,2),noreturn)); extern FILE *logfile; diff --git a/qbsp/util.c b/qbsp/util.c index 7b511fcb..77c99bc3 100644 --- a/qbsp/util.c +++ b/qbsp/util.c @@ -227,6 +227,24 @@ Error(int ErrType, ...) exit(1); } +void +Error_(const char *error, ...) +{ + va_list argptr; + char message[512]; + + va_start(argptr, error); + vsnprintf(message, sizeof(message), error, argptr); + va_end(argptr); + + fprintf(stderr, "\nERROR: %s\n\n", message); + if (logfile) { + fprintf(logfile, "\nERROR: %s\n\n", message); + fclose(logfile); + } + exit(1); +} + /* ================= Message