diff options
author | Mattias Andrée <maandree@operamail.com> | 2014-11-30 16:10:50 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2014-11-30 16:10:50 +0100 |
commit | b95d6cf9e254b289ceae4dd74713137c34e229aa (patch) | |
tree | 05576485f26ffa12cc1fa3b3665a67a0e52ed059 /src | |
parent | whitespace (diff) | |
download | mds-b95d6cf9e254b289ceae4dd74713137c34e229aa.tar.gz mds-b95d6cf9e254b289ceae4dd74713137c34e229aa.tar.bz2 mds-b95d6cf9e254b289ceae4dd74713137c34e229aa.tar.xz |
mds-kbdc: it is possible to print the errors in reverse order
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r-- | src/mds-kbdc/parsed.c | 14 |
1 files changed, 13 insertions, 1 deletions
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 <stdlib.h> #include <string.h> +#include <strings.h> @@ -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); + } |