From 884fc433b4a5bd4a76e345e62d3ae1f0d30911c3 Mon Sep 17 00:00:00 2001 From: midipix Date: Oct 27 2016 02:10:39 +0000 Subject: utility: error trace and error information: initial integration. --- diff --git a/src/driver/amgc_amain.c b/src/driver/amgc_amain.c index ceaa1ff..41b174c 100644 --- a/src/driver/amgc_amain.c +++ b/src/driver/amgc_amain.c @@ -53,10 +53,11 @@ static void amgc_perform_unit_actions(struct amgc_unit_ctx * uctx) amgc_perform_unit_action(uctx,action,0,stdout); } -static int amgc_exit(struct amgc_driver_ctx * dctx, int nerrors) +static int amgc_exit(struct amgc_driver_ctx * dctx, int ret) { + amgc_output_error_vector(dctx); amgc_free_driver_ctx(dctx); - return nerrors ? 2 : 0; + return ret; } int amgc_main(int argc, char ** argv, char ** envp) @@ -76,11 +77,9 @@ int amgc_main(int argc, char ** argv, char ** envp) for (unit=dctx->units; *unit; unit++) { if (!(amgc_get_unit_ctx(dctx,*unit,&uctx))) { amgc_perform_unit_actions(uctx); - ret += uctx->nerrors; amgc_free_unit_ctx(uctx); - } else - ret++; + } } - return amgc_exit(dctx,ret); + return amgc_exit(dctx,dctx->errv[0] ? 2 : 0); }