diff options
author | pommicket <pommicket@gmail.com> | 2023-01-01 12:05:48 -0500 |
---|---|---|
committer | pommicket <pommicket@gmail.com> | 2023-01-01 12:05:48 -0500 |
commit | 8308d6fc53ee339a0b5cac4b9b837179c61efbaa (patch) | |
tree | e4f94a5695e9d5cf035582799738dc2e75c0e779 /ted.c | |
parent | 57834dc0b116a62b806781ddec101bca4cda3abb (diff) |
more reorganizing
Diffstat (limited to 'ted.c')
-rw-r--r-- | ted.c | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -2,6 +2,22 @@ #define ted_seterr(ted, ...) \ snprintf((ted)->error, sizeof (ted)->error - 1, __VA_ARGS__) +static void die(char const *fmt, ...) { + char buf[256] = {0}; + + va_list args; + va_start(args, fmt); + vsnprintf(buf, sizeof buf - 1, fmt, args); + va_end(args); + + // show a message box, and if that fails, print it + if (SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Error", buf, NULL) < 0) { + debug_println("%s\n", buf); + } + + exit(EXIT_FAILURE); +} + void ted_seterr_to_buferr(Ted *ted, TextBuffer *buffer) { size_t size = sizeof ted->error; if (sizeof buffer->error < size) size = sizeof buffer->error; |