diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/driver/mdso_amain.c | 3 | ||||
-rw-r--r-- | src/output/mdso_output_export_symbols.c | 31 |
2 files changed, 20 insertions, 14 deletions
diff --git a/src/driver/mdso_amain.c b/src/driver/mdso_amain.c index 02daefb..ee02363 100644 --- a/src/driver/mdso_amain.c +++ b/src/driver/mdso_amain.c @@ -54,8 +54,7 @@ static void mdso_perform_unit_actions( struct mdso_unit_ctx * uctx) { if (uctx->cctx->fmtflags & MDSO_OUTPUT_EXPORT_SYMS) - mdso_output_export_symbols( - dctx,uctx,stdout); + mdso_output_export_symbols(dctx,uctx); } static int mdso_exit(struct mdso_driver_ctx * dctx, int ret) diff --git a/src/output/mdso_output_export_symbols.c b/src/output/mdso_output_export_symbols.c index 5c8dc66..6f36a6d 100644 --- a/src/output/mdso_output_export_symbols.c +++ b/src/output/mdso_output_export_symbols.c @@ -12,39 +12,46 @@ #include <mdso/mdso.h> #include <mdso/mdso_output.h> +#include "mdso_driver_impl.h" +#include "mdso_dprintf_impl.h" #include "mdso_errinfo_impl.h" -static int pretty_header(const struct mdso_common_ctx * cctx, FILE * fout) +static int pretty_header(int fdout, const struct mdso_common_ctx * cctx) { return (cctx->fmtflags & MDSO_PRETTY_YAML) - ? fputs("exports:\n",fout) + ? mdso_dprintf(fdout,"exports:\n") : 0; } -static int pretty_export_item(const struct mdso_common_ctx * cctx, const char * name, FILE * fout) +static int pretty_export_item( + int fdout, + const struct mdso_common_ctx * cctx, + const char * name) { if (cctx->fmtflags & MDSO_PRETTY_YAML) - return fprintf(fout,"- %s\n",name); + return mdso_dprintf(fdout,"- %s\n",name); else - return fprintf(fout,"%s\n",name); + return mdso_dprintf(fdout,"%s\n",name); } int mdso_output_export_symbols( const struct mdso_driver_ctx * dctx, - const struct mdso_unit_ctx * uctx, - FILE * fout) + const struct mdso_unit_ctx * uctx) { - const char * const * sym; + int fdout; + const char * const * sym; + + fdout = mdso_driver_fdout(dctx); if (!uctx->syms[0]) return 0; - if ((pretty_header(dctx->cctx,fout)) < 0) - return MDSO_FILE_ERROR(dctx); + if ((pretty_header(fdout,dctx->cctx)) < 0) + return MDSO_SYSTEM_ERROR(dctx); for (sym=uctx->syms; *sym; sym++) - if ((pretty_export_item(dctx->cctx,*sym,fout)) < 0) - return MDSO_FILE_ERROR(dctx); + if ((pretty_export_item(fdout,dctx->cctx,*sym)) < 0) + return MDSO_SYSTEM_ERROR(dctx); return 0; } |