Delete contrib/tigrc now obsolete by tigrc
[tig.git] / util.c
blobf9813b714bb8d7e3fb17bcf47e0ece6f17b81732
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 "Success",
19 #define STATUS_CODE_MESSAGE(name, msg) msg
20 STATUS_CODE_INFO(STATUS_CODE_MESSAGE)
23 const char *
24 get_status_message(enum status_code code)
26 if (code == SUCCESS)
27 return "";
28 return status_messages[code];
31 void
32 warn(const char *msg, ...)
34 va_list args;
36 va_start(args, msg);
37 fputs("tig warning: ", stderr);
38 vfprintf(stderr, msg, args);
39 fputs("\n", stderr);
40 va_end(args);
43 die_fn die_callback = NULL;
44 void TIG_NORETURN
45 die(const char *err, ...)
47 va_list args;
49 if (die_callback)
50 die_callback();
52 va_start(args, err);
53 fputs("tig: ", stderr);
54 vfprintf(stderr, err, args);
55 fputs("\n", stderr);
56 va_end(args);
58 exit(1);
61 /* vim: set ts=8 sw=8 noexpandtab: */