diff --git a/ctags/main/error.c b/ctags/main/error.c index a428b92a..d08bd12e 100644 --- a/ctags/main/error.c +++ b/ctags/main/error.c @@ -40,7 +40,7 @@ extern bool stderrDefaultErrorPrinter (const errorSelection selection, #endif fputs ("\n", stderr); - return false; + return (selected (selection, FATAL) || Option.fatalWarnings)? true: false; } extern void error (const errorSelection selection, @@ -50,7 +50,7 @@ extern void error (const errorSelection selection, bool shouldExit; va_start (ap, format); - shouldExit = false; + shouldExit = (* errorPrinter) (selection, format, ap, errorPrinterData); va_end (ap); if (shouldExit) diff --git a/src/tagmanager/tm_ctags_wrappers.c b/src/tagmanager/tm_ctags_wrappers.c index 6d76ef92..26da3e40 100644 --- a/src/tagmanager/tm_ctags_wrappers.c +++ b/src/tagmanager/tm_ctags_wrappers.c @@ -29,16 +29,35 @@ #include "output.h" #include "options.h" +#include +#include + typedef struct { TMCtagsNewTagCallback tag_callback; TMCtagsPassStartCallback pass_callback; gpointer user_data; } CallbackUserData; +extern bool nofatalErrorPrinter (const errorSelection selection, + const char *const format, + va_list ap, void *data CTAGS_ATTR_UNUSED) +{ + fprintf (stderr, "%s: ", (selection & WARNING) ? "Warning: " : "Error"); + vfprintf (stderr, format, ap); + if (selection & PERROR) +#ifdef HAVE_STRERROR + fprintf (stderr, " : %s", strerror (errno)); +#else + perror (" "); +#endif + fputs ("\n", stderr); + + return false; +} void tm_ctags_init(void) { - setErrorPrinter (stderrDefaultErrorPrinter, NULL); + setErrorPrinter (nofatalErrorPrinter, NULL); setTagWriter (&ctagsWriter); checkRegex ();