22#define selected(var,feature) (((int)(var) & (int)(feature)) == (int)feature)
39 vfprintf (stderr,
format, ap);
43 fprintf (stderr,
" : %s", strerror (
errno));
54 const char *
const format, ...)
71#define ERR_BUFFER_SIZE 4096
72 static char reason[ERR_BUFFER_SIZE];
74 vsnprintf (reason, ERR_BUFFER_SIZE,
format, ap);
75 reason [ERR_BUFFER_SIZE - 1] =
'\0';
77 json_t *response = json_object ();
78 json_object_set_new (response,
"_type", json_string (
"error"));
79 json_object_set_new (response,
"message", json_string (reason));
81 json_object_set_new (response,
"warning", json_true ());
83 json_object_set_new (response,
"fatal", json_true ());
86 json_object_set_new (response,
"errno", json_integer (
errno));
87 json_object_set_new (response,
"perror", json_string (strerror (
errno)));
89 json_dumpf (response, stdout, JSON_PRESERVE_ORDER);
90 fprintf (stdout,
"\n");
92 json_decref (response);
void error(const errorSelection selection, const char *const format,...)
static void * errorPrinterData
#define selected(var, feature)
void setErrorPrinter(errorPrintFunc printer, void *data)
bool stderrDefaultErrorPrinter(const errorSelection selection, const char *const format, va_list ap, void *data)
static errorPrintFunc errorPrinter
bool(* errorPrintFunc)(const errorSelection selection, const char *const format, va_list ap, void *data)
#define CTAGS_ATTR_UNUSED
bool jsonErrorPrinter(const errorSelection selection, const char *const format, va_list ap, void *data)
const char * getExecutableName(void)