purrforce/error.c

27 lines
538 B
C

#include <stdio.h>
#include <string.h>
#include "api.h"
#ifdef _WIN32
#include <Windows.h>
static void showError(const char *er) {
int ret = MessageBoxA(NULL,er,"Quit the program?",MB_YESNO|MB_ICONQUESTION|MB_DEFBUTTON2|MB_APPLMODAL);
if(ret == IDYES) {
exit(1);
}
}
#else
static void showError(const char *er){
fprintf(stderr,"%s\n",er);
return;
}
#endif
void reportError(const char *fmt,...){
va_list ap;
char buf[512];
va_start(ap,fmt);
vsnprintf(buf,sizeof buf,fmt,ap);
va_end(ap);
}