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