summaryrefslogtreecommitdiffhomepage
path: root/src/output
diff options
context:
space:
mode:
Diffstat (limited to 'src/output')
-rw-r--r--src/output/pe_output_error.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/output/pe_output_error.c b/src/output/pe_output_error.c
index c08a7d5..e644fee 100644
--- a/src/output/pe_output_error.c
+++ b/src/output/pe_output_error.c
@@ -13,6 +13,7 @@
static const char aclr_reset[] = "\x1b[0m";
static const char aclr_bold[] = "\x1b[1m";
+static const char aclr_red[] = "\x1b[31m";
static const char aclr_green[] = "\x1b[32m";
static const char aclr_blue[] = "\x1b[34m";
static const char aclr_magenta[] = "\x1b[35m";
@@ -70,8 +71,19 @@ static int pe_output_error_record_plain(
const struct pe_driver_ctx * dctx,
const struct pe_error_info * erri)
{
+ const char * epath;
const char * errdesc = pe_output_strerror(erri);
+ epath = erri->euctx
+ ? *erri->euctx->path
+ : erri->eunit;
+
+ if (epath && !(erri->eflags & PERK_ERROR_NESTED))
+ if (fprintf(stderr,"%s: [while opening] '%s':\n",
+ dctx->program,
+ epath) < 0)
+ return -1;
+
if (fprintf(stderr,"%s: %s %s(), line %d%s%s.\n",
dctx->program,
pe_output_error_header(erri),
@@ -88,8 +100,30 @@ static int pe_output_error_record_annotated(
const struct pe_driver_ctx * dctx,
const struct pe_error_info * erri)
{
+ const char * epath;
const char * errdesc = pe_output_strerror(erri);
+ epath = erri->euctx
+ ? *erri->euctx->path
+ : erri->eunit;
+
+ if (epath && !(erri->eflags & PERK_ERROR_NESTED))
+ if (fprintf(
+ stderr,
+ "%s%s%s:%s %s[while opening]%s %s%s'%s'%s:\n",
+
+ aclr_bold,aclr_magenta,
+ dctx->program,
+ aclr_reset,
+
+ aclr_bold,
+ aclr_reset,
+
+ aclr_bold,aclr_red,
+ epath,
+ aclr_reset) < 0)
+ return -1;
+
if (fprintf(
stderr,
"%s%s%s:%s %s%s%s %s%s%s()%s, %s%sline %d%s%s%s%s%s.\n",