summaryrefslogtreecommitdiff
path: root/archival
diff options
context:
space:
mode:
authorDenys Vlasenko2010-01-09 19:56:15 +0100
committerDenys Vlasenko2010-01-09 19:56:15 +0100
commit93ac7d8468feec562b468e87e1e04b0afdec0951 (patch)
treefa45240bf23cdf232f4b76b2d1321d4b29fff146 /archival
parentdc698bb038756a926aaa529bda1b939eab2c1676 (diff)
downloadbusybox-93ac7d8468feec562b468e87e1e04b0afdec0951.zip
busybox-93ac7d8468feec562b468e87e1e04b0afdec0951.tar.gz
cpio: improve help text; document two TODOs
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'archival')
-rw-r--r--archival/cpio.c8
-rw-r--r--archival/libunarchive/get_header_cpio.c4
-rw-r--r--archival/libunarchive/header_list.c1
3 files changed, 11 insertions, 2 deletions
diff --git a/archival/cpio.c b/archival/cpio.c
index b21ba6e..be9fbd0 100644
--- a/archival/cpio.c
+++ b/archival/cpio.c
@@ -304,8 +304,12 @@ int cpio_main(int argc UNUSED_PARAM, char **argv)
/* -L makes sense only with -o or -p */
#if !ENABLE_FEATURE_CPIO_O
+ /* no parameters */
+ opt_complementary = "=0";
opt = getopt32(argv, OPTION_STR, &cpio_filename);
#else
+ /* _exactly_ one parameter for -p, thus <= 1 param if -p is allowed */
+ opt_complementary = ENABLE_FEATURE_CPIO_P ? "?1" : "=0";
opt = getopt32(argv, OPTION_STR "oH:" IF_FEATURE_CPIO_P("p"), &cpio_filename, &cpio_fmt);
argv += optind;
if (opt & CPIO_OPT_PASSTHROUGH) {
@@ -346,13 +350,13 @@ int cpio_main(int argc UNUSED_PARAM, char **argv)
xchdir(*argv++);
close(pp.wr);
xmove_fd(pp.rd, STDIN_FILENO);
- opt &= ~CPIO_OPT_PASSTHROUGH;
+ //opt &= ~CPIO_OPT_PASSTHROUGH;
opt |= CPIO_OPT_EXTRACT;
goto skip;
}
/* -o */
if (opt & CPIO_OPT_CREATE) {
- if (*cpio_fmt != 'n') /* we _require_ "-H newc" */
+ if (cpio_fmt[0] != 'n') /* we _require_ "-H newc" */
bb_show_usage();
if (opt & CPIO_OPT_FILE) {
xmove_fd(xopen3(cpio_filename, O_WRONLY | O_CREAT | O_TRUNC, 0666), STDOUT_FILENO);
diff --git a/archival/libunarchive/get_header_cpio.c b/archival/libunarchive/get_header_cpio.c
index ddc49f7..4507d53 100644
--- a/archival/libunarchive/get_header_cpio.c
+++ b/archival/libunarchive/get_header_cpio.c
@@ -115,6 +115,10 @@ char FAST_FUNC get_header_cpio(archive_handle_t *archive_handle)
if (archive_handle->filter(archive_handle) == EXIT_SUCCESS) {
archive_handle->action_data(archive_handle);
+//TODO: run "echo /etc/hosts | cpio -pv /tmp" twice. On 2nd run:
+//cpio: etc/hosts not created: newer or same age file exists
+//etc/hosts <-- should NOT show it
+//2 blocks <-- should say "0 blocks"
archive_handle->action_header(file_header);
} else {
data_skip(archive_handle);
diff --git a/archival/libunarchive/header_list.c b/archival/libunarchive/header_list.c
index 6ec2df3..b1c425a 100644
--- a/archival/libunarchive/header_list.c
+++ b/archival/libunarchive/header_list.c
@@ -7,5 +7,6 @@
void FAST_FUNC header_list(const file_header_t *file_header)
{
+//TODO: cpio -vp DIR should output "DIR/NAME", not just "NAME" */
puts(file_header->name);
}