summaryrefslogtreecommitdiff
path: root/ted.c
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2023-01-01 12:05:48 -0500
committerpommicket <pommicket@gmail.com>2023-01-01 12:05:48 -0500
commit8308d6fc53ee339a0b5cac4b9b837179c61efbaa (patch)
treee4f94a5695e9d5cf035582799738dc2e75c0e779 /ted.c
parent57834dc0b116a62b806781ddec101bca4cda3abb (diff)
more reorganizing
Diffstat (limited to 'ted.c')
-rw-r--r--ted.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/ted.c b/ted.c
index 611dae2..4580f9a 100644
--- a/ted.c
+++ b/ted.c
@@ -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;