diff options
author | midipix <writeonce@midipix.org> | 2020-12-21 04:00:12 +0000 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2020-12-21 04:00:12 +0000 |
commit | 5c84b659b92bb3d83b9f4bef4db0665ceb184289 (patch) | |
tree | cb66636e442301b2e96d5f8019988a3ee2cea303 | |
parent | 6beda1bcee4396ceced99b8a8c5627940f507ace (diff) | |
download | slibtool-5c84b659b92bb3d83b9f4bef4db0665ceb184289.tar.bz2 slibtool-5c84b659b92bb3d83b9f4bef4db0665ceb184289.tar.xz |
slbt_output_error_record_{plain|annotated}(): output recorded not-found path.
-rw-r--r-- | src/output/slbt_output_error.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/output/slbt_output_error.c b/src/output/slbt_output_error.c index 8f9044e..bedef83 100644 --- a/src/output/slbt_output_error.c +++ b/src/output/slbt_output_error.c @@ -51,6 +51,9 @@ static const char * slbt_output_strerror( else if (erri->esyscode == ENOBUFS) return "input error: string length exceeds buffer size"; + else if ((erri->esyscode == ENOENT) && erri->eany) + return "path not found: "; + else return strerror_r(erri->esyscode,*errbuf,sizeof(*errbuf)) ? "internal error: strerror_r(3) call failed" @@ -65,16 +68,20 @@ static int slbt_output_error_record_plain( int fderr = slbt_driver_fderr(dctx); const char * errdesc = slbt_output_strerror(erri,&errbuf); + const char * path; + + path = ((erri->esyscode == ENOENT) && erri->eany) + ? erri->eany : ""; if (slbt_dprintf( fderr, - "%s: %s %s(), line %d%s%s.\n", + "%s: %s %s(), line %d%s%s%s.\n", dctx->program, slbt_output_error_header(erri), erri->efunction, erri->eline, strlen(errdesc) ? ": " : "", - errdesc) < 0) + errdesc,path) < 0) return -1; return 0; @@ -88,10 +95,14 @@ static int slbt_output_error_record_annotated( int fderr = slbt_driver_fderr(dctx); const char * errdesc = slbt_output_strerror(erri,&errbuf); + const char * path; + + path = ((erri->esyscode == ENOENT) && erri->eany) + ? erri->eany : ""; if (slbt_dprintf( fderr, - "%s%s%s:%s %s%s%s %s%s%s()%s, %s%sline %d%s%s%s%s%s.\n", + "%s%s%s:%s %s%s%s %s%s%s()%s, %s%sline %d%s%s%s%s%s%s%s%s%s.\n", aclr_bold,aclr_magenta, dctx->program, @@ -112,6 +123,10 @@ static int slbt_output_error_record_annotated( aclr_bold, errdesc, + aclr_reset, + + aclr_bold,aclr_blue, + path, aclr_reset) < 0) return -1; |