diff options
Diffstat (limited to 'src/output')
-rw-r--r-- | src/output/pe_output_error.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/src/output/pe_output_error.c b/src/output/pe_output_error.c index 60e8cf6..39d7fd6 100644 --- a/src/output/pe_output_error.c +++ b/src/output/pe_output_error.c @@ -10,6 +10,9 @@ #include <unistd.h> #include <perk/perk.h> +#include "perk_driver_impl.h" +#include "perk_dprintf_impl.h" + static const char aclr_reset[] = "\x1b[0m"; static const char aclr_bold[] = "\x1b[1m"; @@ -86,19 +89,24 @@ static int pe_output_error_record_plain( { const char * epath; const char * errdesc = pe_output_strerror(erri); + int fderr = pe_driver_fderr(dctx); epath = erri->euctx ? *erri->euctx->path : erri->eunit; if (epath && !(erri->eflags & PERK_ERROR_NESTED)) - if (fprintf(stderr,"%s: [%s] '%s':\n", + if (pe_dprintf( + fderr, + "%s: [%s] '%s':\n", dctx->program, pe_output_unit_header(erri), epath) < 0) return -1; - if (fprintf(stderr,"%s: %s %s(), line %d%s%s.\n", + if (pe_dprintf( + fderr, + "%s: %s %s(), line %d%s%s.\n", dctx->program, pe_output_error_header(erri), erri->efunction, @@ -107,7 +115,7 @@ static int pe_output_error_record_plain( errdesc) < 0) return -1; - return fflush(stderr); + return 0; } static int pe_output_error_record_annotated( @@ -116,14 +124,15 @@ static int pe_output_error_record_annotated( { const char * epath; const char * errdesc = pe_output_strerror(erri); + int fderr = pe_driver_fderr(dctx); epath = erri->euctx ? *erri->euctx->path : erri->eunit; if (epath && !(erri->eflags & PERK_ERROR_NESTED)) - if (fprintf( - stderr, + if (pe_dprintf( + fderr, "%s%s%s:%s %s[%s]%s %s%s'%s'%s:\n", aclr_bold,aclr_magenta, @@ -139,8 +148,8 @@ static int pe_output_error_record_annotated( aclr_reset) < 0) return -1; - if (fprintf( - stderr, + if (pe_dprintf( + fderr, "%s%s%s:%s %s%s%s %s%s%s()%s, %s%sline %d%s%s%s%s%s.\n", aclr_bold,aclr_magenta, @@ -165,7 +174,7 @@ static int pe_output_error_record_annotated( aclr_reset) < 0) return -1; - return fflush(stderr); + return 0; } int pe_output_error_record( |