1 /*
2 * GIT - The information manager from hell
3 *
4 * Copyright (C) Linus Torvalds, 2005
5 */
6 #include <stdarg.h>
7 #include "cache.h"
9 static void report(const char *prefix, const char *err, va_list params)
10 {
11 fputs(prefix, stderr);
12 vfprintf(stderr, err, params);
13 fputs("\n", stderr);
14 }
16 void usage(const char *err)
17 {
18 fprintf(stderr, "usage: %s\n", err);
19 exit(1);
20 }
22 void die(const char *err, ...)
23 {
24 va_list params;
26 va_start(params, err);
27 report("fatal: ", err, params);
28 va_end(params);
29 exit(1);
30 }
32 int error(const char *err, ...)
33 {
34 va_list params;
36 va_start(params, err);
37 report("error: ", err, params);
38 va_end(params);
39 return -1;
40 }