Make blame_draw check if the filename is NULL instead of empty
[tig.git] / util.c
blob8352b3bb53d693c5335acbaedf51701be7f0a034
1 /* Copyright (c) 2006-2013 Jonas Fonseca <fonseca@diku.dk>
3 * This program is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU General Public License as
5 * published by the Free Software Foundation; either version 2 of
6 * the License, or (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
14 #include "tig.h"
15 #include "util.h"
17 static const char *status_messages[] = {
18 #define STATUS_CODE_MESSAGE(name, msg) msg
19 STATUS_CODE_INFO(STATUS_CODE_MESSAGE)
22 const char *
23 get_status_message(enum status_code code)
25 if (code == SUCCESS)
26 return "";
27 return status_messages[code];
30 void
31 warn(const char *msg, ...)
33 va_list args;
35 va_start(args, msg);
36 fputs("tig warning: ", stderr);
37 vfprintf(stderr, msg, args);
38 fputs("\n", stderr);
39 va_end(args);
42 die_fn die_callback = NULL;
43 void TIG_NORETURN
44 die(const char *err, ...)
46 va_list args;
48 if (die_callback)
49 die_callback();
51 va_start(args, err);
52 fputs("tig: ", stderr);
53 vfprintf(stderr, err, args);
54 fputs("\n", stderr);
55 va_end(args);
57 exit(1);
60 /* vim: set ts=8 sw=8 noexpandtab: */