From b87f7032b8573966b0537698544c65fbb3f2c143 Mon Sep 17 00:00:00 2001 From: midipix Date: Mon, 22 Jan 2024 01:42:49 +0000 Subject: ar mode: added --version support. --- src/driver/slbt_amain.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/driver/slbt_amain.c') diff --git a/src/driver/slbt_amain.c b/src/driver/slbt_amain.c index 2359293..b6bbe40 100644 --- a/src/driver/slbt_amain.c +++ b/src/driver/slbt_amain.c @@ -177,12 +177,20 @@ int slbt_main(char ** argv, char ** envp, const struct slbt_fd_ctx * fdctx) ? SLBT_ERROR : SLBT_OK; /* --version must be the first (and only) action */ + if (dctx->cctx->drvflags & SLBT_DRIVER_VERSION) + if (dctx->cctx->mode != SLBT_MODE_AR) + return (slbt_version(dctx,fdout) < 0) + ? slbt_exit(dctx,SLBT_ERROR) + : slbt_exit(dctx,SLBT_OK); + + /* perform all other actions */ + slbt_perform_driver_actions(dctx); + + /* print --version on behalf of a secondary tool as needed */ if (dctx->cctx->drvflags & SLBT_DRIVER_VERSION) return (slbt_version(dctx,fdout) < 0) ? slbt_exit(dctx,SLBT_ERROR) : slbt_exit(dctx,SLBT_OK); - slbt_perform_driver_actions(dctx); - return slbt_exit(dctx,dctx->errv[0] ? SLBT_ERROR : SLBT_OK); } -- cgit v1.2.3