From b95d6cf9e254b289ceae4dd74713137c34e229aa Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sun, 30 Nov 2014 16:10:50 +0100 Subject: mds-kbdc: it is possible to print the errors in reverse order MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/mds-kbdc/parsed.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mds-kbdc/parsed.c b/src/mds-kbdc/parsed.c index 81b1f04..45abd23 100644 --- a/src/mds-kbdc/parsed.c +++ b/src/mds-kbdc/parsed.c @@ -19,6 +19,7 @@ #include #include +#include @@ -70,9 +71,20 @@ int mds_kbdc_parsed_is_fatal(mds_kbdc_parsed_t* restrict this) void mds_kbdc_parsed_print_errors(mds_kbdc_parsed_t* restrict this, FILE* output) { mds_kbdc_parse_error_t** errors = this->errors; - if (errors) + char* env = getenv("MDS_KBDC_ERRORS_ORDER"); + if (errors == NULL) + return; + if (env && (strcasecmp(env, "reversed") || strcasecmp(env, "reverse"))) + { + while (*errors) + errors++; + while (errors-- != this->errors) + mds_kbdc_parse_error_print(*errors, output); + } + else while (*errors) mds_kbdc_parse_error_print(*errors++, output); + } -- cgit v1.2.3-70-g09d2