From 5ce6ff10c2cced4bf75db11b16984d565cf1ebec Mon Sep 17 00:00:00 2001 From: midipix Date: Sun, 26 May 2024 03:22:34 +0000 Subject: logic: tpax_archive_write(): initial implementation and integration. --- src/driver/tpax_amain.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'src/driver') diff --git a/src/driver/tpax_amain.c b/src/driver/tpax_amain.c index 293535a..9e76d08 100644 --- a/src/driver/tpax_amain.c +++ b/src/driver/tpax_amain.c @@ -57,6 +57,20 @@ static void tpax_perform_unit_actions( tpax_archive_append_item(dctx,uctx); } +static void tpax_archive_write_and_seal( + const struct tpax_driver_ctx * dctx) +{ + if (tpax_archive_write(dctx) == TPAX_OK) + tpax_archive_seal(dctx); +} + +static void tpax_perform_archive_actions( + const struct tpax_driver_ctx * dctx) +{ + if (dctx->cctx->drvflags & TPAX_DRIVER_EXEC_MODE_WRITE) + tpax_archive_write_and_seal(dctx); +} + static int tpax_exit(struct tpax_driver_ctx * dctx, int ret) { tpax_output_error_vector(dctx); @@ -94,8 +108,7 @@ int tpax_main(char ** argv, char ** envp, const struct tpax_fd_ctx * fdctx) } } - if ((dctx->cctx->drvflags & TPAX_DRIVER_EXEC_MODE_WRITE) && dctx->units[0]) - tpax_archive_seal(dctx); + tpax_perform_archive_actions(dctx); return tpax_exit(dctx,dctx->errv[0] ? TPAX_ERROR : TPAX_OK); } -- cgit v1.2.3