From 695f71d9462ce3fe0bdcbe7fae9015ce254512fd Mon Sep 17 00:00:00 2001 From: Přemysl Eric Janouch Date: Thu, 3 Sep 2020 23:54:12 +0200 Subject: tools: clean up error message printing --- src/utils.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/utils.c') 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 + * Copyright (c) 2013 - 2020, Přemysl Eric Janouch * * 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 #include #include +#include #include #include @@ -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); +} -- cgit v1.2.3-70-g09d2