summaryrefslogtreecommitdiff
path: root/src/output/slbt_output_config.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/output/slbt_output_config.c')
-rw-r--r--src/output/slbt_output_config.c31
1 files changed, 17 insertions, 14 deletions
diff --git a/src/output/slbt_output_config.c b/src/output/slbt_output_config.c
index 800c6c3..fc8f5ca 100644
--- a/src/output/slbt_output_config.c
+++ b/src/output/slbt_output_config.c
@@ -9,6 +9,8 @@
#include <stdbool.h>
#include <slibtool/slibtool.h>
+#include "slibtool_driver_impl.h"
+#include "slibtool_dprintf_impl.h"
#include "slibtool_errinfo_impl.h"
#ifndef SLBT_TAB_WIDTH
@@ -20,12 +22,13 @@
#endif
static bool slbt_output_config_line(
+ int fd,
const char * key,
const char * value,
const char * annotation,
int midwidth)
{
- return (fprintf(stdout,"%-*s%-*s%s\n",
+ return (slbt_dprintf(fd,"%-*s%-*s%s\n",
SLBT_KEY_WIDTH, key,
midwidth, value ? value : "",
annotation ? annotation : "") < 0)
@@ -39,11 +42,13 @@ int slbt_output_config(const struct slbt_driver_ctx * dctx)
const char * target;
int len;
int midwidth;
+ int fdout;
cctx = dctx->cctx;
compiler = cctx->cargv[0] ? cctx->cargv[0] : "";
target = cctx->target ? cctx->target : "";
midwidth = strlen(compiler);
+ fdout = slbt_driver_fdout(dctx);
if ((len = strlen(target)) > midwidth)
midwidth = len;
@@ -69,37 +74,35 @@ int slbt_output_config(const struct slbt_driver_ctx * dctx)
midwidth += SLBT_TAB_WIDTH;
midwidth &= (~(SLBT_TAB_WIDTH-1));
- if (slbt_output_config_line("key","value","annotation",midwidth))
+ if (slbt_output_config_line(fdout,"key","value","annotation",midwidth))
return SLBT_SYSTEM_ERROR(dctx);
- if (slbt_output_config_line("---","-----","----------",midwidth))
+ if (slbt_output_config_line(fdout,"---","-----","----------",midwidth))
return SLBT_SYSTEM_ERROR(dctx);
- if (slbt_output_config_line("compiler",cctx->cargv[0],"",midwidth))
+ if (slbt_output_config_line(fdout,"compiler",cctx->cargv[0],"",midwidth))
return SLBT_SYSTEM_ERROR(dctx);
- if (slbt_output_config_line("target",cctx->target,"",midwidth))
+ if (slbt_output_config_line(fdout,"target",cctx->target,"",midwidth))
return SLBT_SYSTEM_ERROR(dctx);
- if (slbt_output_config_line("host",cctx->host.host,cctx->cfgmeta.host,midwidth))
+ if (slbt_output_config_line(fdout,"host",cctx->host.host,cctx->cfgmeta.host,midwidth))
return SLBT_SYSTEM_ERROR(dctx);
- if (slbt_output_config_line("flavor",cctx->host.flavor,cctx->cfgmeta.flavor,midwidth))
+ if (slbt_output_config_line(fdout,"flavor",cctx->host.flavor,cctx->cfgmeta.flavor,midwidth))
return SLBT_SYSTEM_ERROR(dctx);
- if (slbt_output_config_line("ar",cctx->host.ar,cctx->cfgmeta.ar,midwidth))
+ if (slbt_output_config_line(fdout,"ar",cctx->host.ar,cctx->cfgmeta.ar,midwidth))
return SLBT_SYSTEM_ERROR(dctx);
- if (slbt_output_config_line("ranlib",cctx->host.ranlib,cctx->cfgmeta.ranlib,midwidth))
+ if (slbt_output_config_line(fdout,"ranlib",cctx->host.ranlib,cctx->cfgmeta.ranlib,midwidth))
return SLBT_SYSTEM_ERROR(dctx);
- if (slbt_output_config_line("dlltool",cctx->host.dlltool,cctx->cfgmeta.dlltool,midwidth))
+ if (slbt_output_config_line(fdout,"dlltool",cctx->host.dlltool,cctx->cfgmeta.dlltool,midwidth))
return SLBT_SYSTEM_ERROR(dctx);
- if (slbt_output_config_line("mdso",cctx->host.mdso,cctx->cfgmeta.mdso,midwidth))
+ if (slbt_output_config_line(fdout,"mdso",cctx->host.mdso,cctx->cfgmeta.mdso,midwidth))
return SLBT_SYSTEM_ERROR(dctx);
- return fflush(stdout)
- ? SLBT_SYSTEM_ERROR(dctx)
- : 0;
+ return 0;
}