aboutsummaryrefslogtreecommitdiff
path: root/src/utils.c
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2020-09-03 23:54:12 +0200
committerPřemysl Eric Janouch <p@janouch.name>2020-09-04 00:13:34 +0200
commit695f71d9462ce3fe0bdcbe7fae9015ce254512fd (patch)
tree88ca5eebc13f3868c6c9c850c6eb00a8aa085e58 /src/utils.c
parent8d19acd91af9592d862ef2a7aa8e95eea4160152 (diff)
downloadtdv-695f71d9462ce3fe0bdcbe7fae9015ce254512fd.tar.gz
tdv-695f71d9462ce3fe0bdcbe7fae9015ce254512fd.tar.xz
tdv-695f71d9462ce3fe0bdcbe7fae9015ce254512fd.zip
tools: clean up error message printing
Diffstat (limited to 'src/utils.c')
-rw-r--r--src/utils.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/utils.c b/src/utils.c
index ac203a5..89cca9a 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -1,7 +1,7 @@
/*
* utils.c: miscellaneous utilities
*
- * Copyright (c) 2013 - 2015, Přemysl Eric Janouch <p@janouch.name>
+ * Copyright (c) 2013 - 2020, Přemysl Eric Janouch <p@janouch.name>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted.
@@ -20,6 +20,7 @@
#include <gio/gio.h>
#include <stdlib.h>
#include <errno.h>
+#include <stdarg.h>
#include <curses.h>
#include <termios.h>
@@ -99,3 +100,14 @@ update_curses_terminal_size (void)
refresh ();
#endif // HAVE_RESIZETERM && TIOCGWINSZ
}
+
+/// Print a fatal error message and terminate the process immediately.
+void
+fatal (const gchar *format, ...)
+{
+ va_list ap;
+ va_start (ap, format);
+ vfprintf (stderr, format, ap);
+ exit (EXIT_FAILURE);
+ va_end (ap);
+}