summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2016-09-03 14:50:14 -0400
committermidipix <writeonce@midipix.org>2016-09-03 23:23:49 -0400
commit5221639b3f18e30194c9865d969cfccd0d1a3c1f (patch)
tree123d42f36166cca3edfef2b1eacc134519da9912 /src
parent9c9f287a5fb74927817b69be16fbbf93aaae91de (diff)
downloadslibtool-5221639b3f18e30194c9865d969cfccd0d1a3c1f.tar.bz2
slibtool-5221639b3f18e30194c9865d969cfccd0d1a3c1f.tar.xz
output: added error trace support.
Diffstat (limited to 'src')
-rw-r--r--src/output/slbt_output_config.c23
-rw-r--r--src/output/slbt_output_exec.c17
2 files changed, 23 insertions, 17 deletions
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 <stdbool.h>
#include <slibtool/slibtool.h>
+#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 <unistd.h>
#include <stdio.h>
#include <slibtool/slibtool.h>
+#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(