2005-04-19 00:04:43 +04:00
|
|
|
/*
|
|
|
|
* GIT - The information manager from hell
|
|
|
|
*
|
|
|
|
* Copyright (C) Linus Torvalds, 2005
|
|
|
|
*/
|
2005-12-05 22:54:29 +03:00
|
|
|
#include "git-compat-util.h"
|
2005-04-19 00:04:43 +04:00
|
|
|
|
|
|
|
static void report(const char *prefix, const char *err, va_list params)
|
|
|
|
{
|
|
|
|
fputs(prefix, stderr);
|
|
|
|
vfprintf(stderr, err, params);
|
|
|
|
fputs("\n", stderr);
|
|
|
|
}
|
|
|
|
|
|
|
|
void usage(const char *err)
|
|
|
|
{
|
|
|
|
fprintf(stderr, "usage: %s\n", err);
|
2005-10-02 00:24:27 +04:00
|
|
|
exit(129);
|
2005-04-19 00:04:43 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void die(const char *err, ...)
|
|
|
|
{
|
|
|
|
va_list params;
|
|
|
|
|
|
|
|
va_start(params, err);
|
|
|
|
report("fatal: ", err, params);
|
|
|
|
va_end(params);
|
2005-10-02 00:24:27 +04:00
|
|
|
exit(128);
|
2005-04-19 00:04:43 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
int error(const char *err, ...)
|
|
|
|
{
|
|
|
|
va_list params;
|
|
|
|
|
|
|
|
va_start(params, err);
|
|
|
|
report("error: ", err, params);
|
|
|
|
va_end(params);
|
|
|
|
return -1;
|
|
|
|
}
|