summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2020-01-30 20:19:24 -0500
committermidipix <writeonce@midipix.org>2020-05-23 05:59:01 +0000
commit23fa887f1584afb60aeb38288bb74837e4f067db (patch)
treeb81afb06de734339762bd1797569c6865f8bdf86
parent54c29f3214d9ad43bd0eeab1ff025af8bfbf1309 (diff)
downloadtpax-23fa887f1584afb60aeb38288bb74837e4f067db.tar.bz2
tpax-23fa887f1584afb60aeb38288bb74837e4f067db.tar.xz
driver: implemented directory archive member recursion logic.
-rw-r--r--include/tpax/tpax.h2
-rw-r--r--src/driver/tpax_amain.c3
-rw-r--r--src/driver/tpax_driver_ctx.c22
-rw-r--r--src/internal/tpax_driver_impl.h2
-rw-r--r--src/skin/tpax_skin_default.c7
5 files changed, 31 insertions, 5 deletions
diff --git a/include/tpax/tpax.h b/include/tpax/tpax.h
index 0be10f9..d9c73ad 100644
--- a/include/tpax/tpax.h
+++ b/include/tpax/tpax.h
@@ -48,6 +48,8 @@ extern "C" {
#define TPAX_DRIVER_WRITE_FORMAT_USTAR 0x40000
#define TPAX_DRIVER_WRITE_FORMAT_RUSTAR 0x80000
+#define TPAX_DRIVER_DIR_MEMBER_RECURSE 0x100000
+
/* error flags */
#define TPAX_ERROR_TOP_LEVEL 0x0001
#define TPAX_ERROR_NESTED 0x0002
diff --git a/src/driver/tpax_amain.c b/src/driver/tpax_amain.c
index f71f16c..84b15f4 100644
--- a/src/driver/tpax_amain.c
+++ b/src/driver/tpax_amain.c
@@ -12,7 +12,8 @@
#ifndef TPAX_DRIVER_FLAGS
#define TPAX_DRIVER_FLAGS TPAX_DRIVER_VERBOSITY_ERRORS \
- | TPAX_DRIVER_VERBOSITY_USAGE
+ | TPAX_DRIVER_VERBOSITY_USAGE \
+ | TPAX_DRIVER_DIR_MEMBER_RECURSE
#endif
static const char vermsg[] = "%s%s%s (https://git.foss21.org/tpax): "
diff --git a/src/driver/tpax_driver_ctx.c b/src/driver/tpax_driver_ctx.c
index 81c4e34..d8e2de8 100644
--- a/src/driver/tpax_driver_ctx.c
+++ b/src/driver/tpax_driver_ctx.c
@@ -83,10 +83,10 @@ static int tpax_driver_usage(
snprintf(header,sizeof(header),
"%s — topological pax implementation\n\n"
"Synopsis:\n"
- " %s\n"
- " %s -r\n"
- " %s -w [−x format] [-b blocksize]\n"
- " %s -r -w\n\n"
+ " %s [-d]\n"
+ " %s -r [-d]\n"
+ " %s -w [−x format] [-b blocksize] [-d]\n"
+ " %s -r -w [-d]\n\n"
"Options:\n",
program,program,program,program,program);
@@ -395,6 +395,14 @@ int tpax_get_driver_ctx(
program,entry->arg,
optv,meta);
break;
+
+ case TAG_RECURSE:
+ cctx.drvflags |= TPAX_DRIVER_DIR_MEMBER_RECURSE;
+ break;
+
+ case TAG_NORECURSE:
+ cctx.drvflags &= ~(uintptr_t)TPAX_DRIVER_DIR_MEMBER_RECURSE;
+ break;
}
} else {
operand = entry;
@@ -500,6 +508,12 @@ int tpax_get_driver_ctx(
break;
}
+ /* not implemented features */
+ if (cctx.drvflags & TPAX_DRIVER_EXEC_MODE_MASK)
+ if (cctx.drvflags & TPAX_DRIVER_DIR_MEMBER_RECURSE)
+ return tpax_driver_error_not_implemented(
+ fdctx->fderr,program,"directory recursion",meta);
+
/* driver ctx */
if (!(ctx = tpax_driver_ctx_alloc(meta,fdctx,&cctx,nunits))) {
if (cctx.drvflags & TPAX_DRIVER_EXEC_MODE_COPY)
diff --git a/src/internal/tpax_driver_impl.h b/src/internal/tpax_driver_impl.h
index 0a5c583..74af288 100644
--- a/src/internal/tpax_driver_impl.h
+++ b/src/internal/tpax_driver_impl.h
@@ -28,6 +28,8 @@ enum app_tags {
TAG_COPY,
TAG_FORMAT,
TAG_BLKSIZE,
+ TAG_RECURSE,
+ TAG_NORECURSE,
};
struct tpax_driver_ctx_impl {
diff --git a/src/skin/tpax_skin_default.c b/src/skin/tpax_skin_default.c
index dacc9d8..c6de7e6 100644
--- a/src/skin/tpax_skin_default.c
+++ b/src/skin/tpax_skin_default.c
@@ -34,5 +34,12 @@ const struct argv_option tpax_default_options[] = {
" 10240 for the ustar format) "
"is strongly recommended."},
+ {"recurse", 0,TAG_RECURSE,ARGV_OPTARG_NONE,0,0,0,
+ "recurse into directory archive members "
+ "(this is the tpax_main() default)"},
+
+ {"no-recurse", 'd',TAG_NORECURSE,ARGV_OPTARG_NONE,0,0,0,
+ "do not recurse into directory archive members"},
+
{0,0,0,0,0,0,0,0}
};