From 5221639b3f18e30194c9865d969cfccd0d1a3c1f Mon Sep 17 00:00:00 2001 From: midipix Date: Sat, 3 Sep 2016 14:50:14 -0400 Subject: output: added error trace support. --- src/output/slbt_output_config.c | 23 +++++++++++++---------- src/output/slbt_output_exec.c | 17 ++++++++++------- 2 files changed, 23 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/output/slbt_output_config.c b/src/output/slbt_output_config.c index d10a80e..ea7abae 100644 --- a/src/output/slbt_output_config.c +++ b/src/output/slbt_output_config.c @@ -9,6 +9,7 @@ #include #include +#include "slibtool_errinfo_impl.h" #ifndef SLBT_TAB_WIDTH #define SLBT_TAB_WIDTH 8 @@ -66,31 +67,33 @@ int slbt_output_config(const struct slbt_driver_ctx * dctx) midwidth &= (~(SLBT_TAB_WIDTH-1)); if (slbt_output_config_line("key","value","annotation",midwidth)) - return -1; + return SLBT_SYSTEM_ERROR(dctx); if (slbt_output_config_line("---","-----","----------",midwidth)) - return -1; + return SLBT_SYSTEM_ERROR(dctx); if (slbt_output_config_line("compiler",cctx->cargv[0],"",midwidth)) - return -1; + return SLBT_SYSTEM_ERROR(dctx); if (slbt_output_config_line("target",cctx->target,"",midwidth)) - return -1; + return SLBT_SYSTEM_ERROR(dctx); if (slbt_output_config_line("host",cctx->host.host,cctx->cfgmeta.host,midwidth)) - return -1; + return SLBT_SYSTEM_ERROR(dctx); if (slbt_output_config_line("flavor",cctx->host.flavor,cctx->cfgmeta.flavor,midwidth)) - return -1; + return SLBT_SYSTEM_ERROR(dctx); if (slbt_output_config_line("ar",cctx->host.ar,cctx->cfgmeta.ar,midwidth)) - return -1; + return SLBT_SYSTEM_ERROR(dctx); if (slbt_output_config_line("ranlib",cctx->host.ranlib,cctx->cfgmeta.ranlib,midwidth)) - return -1; + return SLBT_SYSTEM_ERROR(dctx); if (slbt_output_config_line("dlltool",cctx->host.dlltool,cctx->cfgmeta.dlltool,midwidth)) - return -1; + return SLBT_SYSTEM_ERROR(dctx); - return fflush(stdout); + return fflush(stdout) + ? SLBT_SYSTEM_ERROR(dctx) + : 0; } diff --git a/src/output/slbt_output_exec.c b/src/output/slbt_output_exec.c index f9d0eda..6360ca2 100644 --- a/src/output/slbt_output_exec.c +++ b/src/output/slbt_output_exec.c @@ -7,6 +7,7 @@ #include #include #include +#include "slibtool_errinfo_impl.h" static const char aclr_null[] = ""; static const char aclr_reset[] = "\x1b[0m"; @@ -30,7 +31,7 @@ static int slbt_output_exec_annotated( aclr_bold,aclr_magenta, dctx->program,aclr_reset, aclr_bold,aclr_green,step,aclr_reset) < 0) - return -1; + return SLBT_SYSTEM_ERROR(dctx); for (parg=ectx->argv; *parg; parg++) { if ((parg == ectx->lout[0]) || (parg == ectx->mout[0])) { @@ -47,12 +48,12 @@ static int slbt_output_exec_annotated( aclr_set,aclr_color, *parg, aclr_unset) < 0) - return -1; + return SLBT_SYSTEM_ERROR(dctx); } if (fputc('\n',stdout) < 0) - return -1; + return SLBT_SYSTEM_ERROR(dctx); return fflush(stdout); } @@ -65,16 +66,18 @@ static int slbt_output_exec_plain( char ** parg; if (fprintf(stdout,"%s: %s:",dctx->program,step) < 0) - return -1; + return SLBT_SYSTEM_ERROR(dctx); for (parg=ectx->argv; *parg; parg++) if (fprintf(stdout," %s",*parg) < 0) - return -1; + return SLBT_SYSTEM_ERROR(dctx); if (fputc('\n',stdout) < 0) - return -1; + return SLBT_SYSTEM_ERROR(dctx); - return fflush(stdout); + return fflush(stdout) + ? SLBT_SYSTEM_ERROR(dctx) + : 0; } int slbt_output_exec( -- cgit v1.2.3