static inline void _perror_x(const char *errstr) { char str[1024]; char *errmsg; errmsg = strerror(errno); sprintf(str, "%s: %s: %s\n", EXECNAME, errstr, errmsg); console_err(str); messagebox(EXECNAME, str); }
void panic(const char *message) { char str[1024]; sprintf(str, "%s: panic: %s\n", EXECNAME, message); console_err(str); messagebox(EXECNAME, str); #if !defined(WIN32) exit(EXIT_FAILURE); #endif }
int fill_rect(SDL_Surface* surface, SDL_Rect *rect, SDL_Color rgb) { int ret; if (surface == NULL) return(-1); if ((ret = SDL_FillRect(surface, rect, SDL_MapRGB(surface->format, rgb.r, rgb.g, rgb.b))) < 0) console_err("SDL_FillRect failed"); return (ret); }
void panicf(const char *format, ...) { va_list ap; char str[1024]; int ptr; ptr = sprintf(str, "%s: panic: ", EXECNAME); va_start(ap, format); ptr += vsprintf(&str[ptr], format, ap); va_end(ap); sprintf(&str[ptr], "\n"); console_err(str); messagebox(EXECNAME, str); #if !defined(WIN32) exit(EXIT_FAILURE); #endif }