diff options
author | midipix <writeonce@midipix.org> | 2016-10-25 16:49:10 -0400 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2016-11-10 23:35:54 -0500 |
commit | f006c46ea91111f1df8bf0ce7cf457e22f4c26f7 (patch) | |
tree | 525e9dc934117bd388ad81bda65ad6efdb23f6db /src/output | |
parent | e2d4c06d82afc047b4c42e418409fc20c6f8090d (diff) | |
download | perk-f006c46ea91111f1df8bf0ce7cf457e22f4c26f7.tar.bz2 perk-f006c46ea91111f1df8bf0ce7cf457e22f4c26f7.tar.xz |
driver: struct pe_error_info: extend and refactor.
Diffstat (limited to 'src/output')
-rw-r--r-- | src/output/pe_output_error.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/output/pe_output_error.c b/src/output/pe_output_error.c index 33e2b7a..c08a7d5 100644 --- a/src/output/pe_output_error.c +++ b/src/output/pe_output_error.c @@ -33,13 +33,13 @@ static const char const * const pe_error_strings[PERK_ERR_CAP] = { static const char * pe_output_error_header(const struct pe_error_info * erri) { - if (erri->flags & PERK_ERROR_CHILD) + if (erri->eflags & PERK_ERROR_CHILD) return "exec error upon"; - else if (erri->flags & PERK_ERROR_TOP_LEVEL) + else if (erri->eflags & PERK_ERROR_TOP_LEVEL) return "error logged in"; - else if (erri->flags & PERK_ERROR_NESTED) + else if (erri->eflags & PERK_ERROR_NESTED) return "< returned to >"; else @@ -48,22 +48,22 @@ static const char * pe_output_error_header(const struct pe_error_info * erri) static const char * pe_output_strerror(const struct pe_error_info * erri) { - if (erri->flags & PERK_ERROR_CUSTOM) - return ((erri->liberror < 0) || (erri->liberror >= PERK_ERR_CAP)) + if (erri->eflags & PERK_ERROR_CUSTOM) + return ((erri->elibcode < 0) || (erri->elibcode >= PERK_ERR_CAP)) ? "internal error: please report to the maintainer" - : pe_error_strings[erri->liberror]; + : pe_error_strings[erri->elibcode]; - else if (erri->flags & PERK_ERROR_NESTED) + else if (erri->eflags & PERK_ERROR_NESTED) return ""; - else if (erri->flags & PERK_ERROR_CHILD) + else if (erri->eflags & PERK_ERROR_CHILD) return "(see child process error messages)"; - else if (erri->syserror == ENOBUFS) + else if (erri->esyscode == ENOBUFS) return "input error: string length exceeds buffer size."; else - return strerror(erri->syserror); + return strerror(erri->esyscode); } static int pe_output_error_record_plain( @@ -75,8 +75,8 @@ static int pe_output_error_record_plain( if (fprintf(stderr,"%s: %s %s(), line %d%s%s.\n", dctx->program, pe_output_error_header(erri), - erri->function, - erri->line, + erri->efunction, + erri->eline, strlen(errdesc) ? ": " : "", errdesc) < 0) return -1; @@ -103,11 +103,11 @@ static int pe_output_error_record_annotated( aclr_reset, aclr_bold,aclr_blue, - erri->function, + erri->efunction, aclr_reset, aclr_bold,aclr_green, - erri->line, + erri->eline, aclr_reset, strlen(errdesc) ? ": " : "", |