diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2010-01-09 19:56:15 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-01-09 19:56:15 +0100 |
commit | 93ac7d8468feec562b468e87e1e04b0afdec0951 (patch) | |
tree | fa45240bf23cdf232f4b76b2d1321d4b29fff146 | |
parent | dc698bb038756a926aaa529bda1b939eab2c1676 (diff) | |
download | busybox-w32-93ac7d8468feec562b468e87e1e04b0afdec0951.tar.gz busybox-w32-93ac7d8468feec562b468e87e1e04b0afdec0951.tar.bz2 busybox-w32-93ac7d8468feec562b468e87e1e04b0afdec0951.zip |
cpio: improve help text; document two TODOs
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | archival/cpio.c | 8 | ||||
-rw-r--r-- | archival/libunarchive/get_header_cpio.c | 4 | ||||
-rw-r--r-- | archival/libunarchive/header_list.c | 1 | ||||
-rw-r--r-- | include/usage.h | 12 |
4 files changed, 19 insertions, 6 deletions
diff --git a/archival/cpio.c b/archival/cpio.c index b21ba6e79..be9fbd0b5 100644 --- a/archival/cpio.c +++ b/archival/cpio.c | |||
@@ -304,8 +304,12 @@ int cpio_main(int argc UNUSED_PARAM, char **argv) | |||
304 | /* -L makes sense only with -o or -p */ | 304 | /* -L makes sense only with -o or -p */ |
305 | 305 | ||
306 | #if !ENABLE_FEATURE_CPIO_O | 306 | #if !ENABLE_FEATURE_CPIO_O |
307 | /* no parameters */ | ||
308 | opt_complementary = "=0"; | ||
307 | opt = getopt32(argv, OPTION_STR, &cpio_filename); | 309 | opt = getopt32(argv, OPTION_STR, &cpio_filename); |
308 | #else | 310 | #else |
311 | /* _exactly_ one parameter for -p, thus <= 1 param if -p is allowed */ | ||
312 | opt_complementary = ENABLE_FEATURE_CPIO_P ? "?1" : "=0"; | ||
309 | opt = getopt32(argv, OPTION_STR "oH:" IF_FEATURE_CPIO_P("p"), &cpio_filename, &cpio_fmt); | 313 | opt = getopt32(argv, OPTION_STR "oH:" IF_FEATURE_CPIO_P("p"), &cpio_filename, &cpio_fmt); |
310 | argv += optind; | 314 | argv += optind; |
311 | if (opt & CPIO_OPT_PASSTHROUGH) { | 315 | if (opt & CPIO_OPT_PASSTHROUGH) { |
@@ -346,13 +350,13 @@ int cpio_main(int argc UNUSED_PARAM, char **argv) | |||
346 | xchdir(*argv++); | 350 | xchdir(*argv++); |
347 | close(pp.wr); | 351 | close(pp.wr); |
348 | xmove_fd(pp.rd, STDIN_FILENO); | 352 | xmove_fd(pp.rd, STDIN_FILENO); |
349 | opt &= ~CPIO_OPT_PASSTHROUGH; | 353 | //opt &= ~CPIO_OPT_PASSTHROUGH; |
350 | opt |= CPIO_OPT_EXTRACT; | 354 | opt |= CPIO_OPT_EXTRACT; |
351 | goto skip; | 355 | goto skip; |
352 | } | 356 | } |
353 | /* -o */ | 357 | /* -o */ |
354 | if (opt & CPIO_OPT_CREATE) { | 358 | if (opt & CPIO_OPT_CREATE) { |
355 | if (*cpio_fmt != 'n') /* we _require_ "-H newc" */ | 359 | if (cpio_fmt[0] != 'n') /* we _require_ "-H newc" */ |
356 | bb_show_usage(); | 360 | bb_show_usage(); |
357 | if (opt & CPIO_OPT_FILE) { | 361 | if (opt & CPIO_OPT_FILE) { |
358 | xmove_fd(xopen3(cpio_filename, O_WRONLY | O_CREAT | O_TRUNC, 0666), STDOUT_FILENO); | 362 | 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 ddc49f70e..4507d538b 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) | |||
115 | 115 | ||
116 | if (archive_handle->filter(archive_handle) == EXIT_SUCCESS) { | 116 | if (archive_handle->filter(archive_handle) == EXIT_SUCCESS) { |
117 | archive_handle->action_data(archive_handle); | 117 | archive_handle->action_data(archive_handle); |
118 | //TODO: run "echo /etc/hosts | cpio -pv /tmp" twice. On 2nd run: | ||
119 | //cpio: etc/hosts not created: newer or same age file exists | ||
120 | //etc/hosts <-- should NOT show it | ||
121 | //2 blocks <-- should say "0 blocks" | ||
118 | archive_handle->action_header(file_header); | 122 | archive_handle->action_header(file_header); |
119 | } else { | 123 | } else { |
120 | data_skip(archive_handle); | 124 | data_skip(archive_handle); |
diff --git a/archival/libunarchive/header_list.c b/archival/libunarchive/header_list.c index 6ec2df363..b1c425aca 100644 --- a/archival/libunarchive/header_list.c +++ b/archival/libunarchive/header_list.c | |||
@@ -7,5 +7,6 @@ | |||
7 | 7 | ||
8 | void FAST_FUNC header_list(const file_header_t *file_header) | 8 | void FAST_FUNC header_list(const file_header_t *file_header) |
9 | { | 9 | { |
10 | //TODO: cpio -vp DIR should output "DIR/NAME", not just "NAME" */ | ||
10 | puts(file_header->name); | 11 | puts(file_header->name); |
11 | } | 12 | } |
diff --git a/include/usage.h b/include/usage.h index 8c11ac466..65836d8ce 100644 --- a/include/usage.h +++ b/include/usage.h | |||
@@ -560,11 +560,15 @@ | |||
560 | "\n -l,-s Create (sym)links" \ | 560 | "\n -l,-s Create (sym)links" \ |
561 | 561 | ||
562 | #define cpio_trivial_usage \ | 562 | #define cpio_trivial_usage \ |
563 | "-[ti" IF_FEATURE_CPIO_O("o") IF_FEATURE_CPIO_P("p") "dmvu] [-F FILE]" \ | 563 | "[-ti" IF_FEATURE_CPIO_O("o") "]" IF_FEATURE_CPIO_P(" [-p DIR]") \ |
564 | IF_FEATURE_CPIO_O( " [-H newc]" ) | 564 | " [-dmvu] [-F FILE]" IF_FEATURE_CPIO_O(" [-H newc]") |
565 | #define cpio_full_usage "\n\n" \ | 565 | #define cpio_full_usage "\n\n" \ |
566 | "Extract or list files from a cpio archive" \ | 566 | "Extract or list files from a cpio archive" \ |
567 | IF_FEATURE_CPIO_O( ", or create a cpio archive" ) \ | 567 | IF_FEATURE_CPIO_O(", or" \ |
568 | "\ncreate an archive" IF_FEATURE_CPIO_P(" (-o) or copy files (-p)") \ | ||
569 | " using file list on standard input" \ | ||
570 | ) \ | ||
571 | "\n" \ | ||
568 | "\nMain operation mode:" \ | 572 | "\nMain operation mode:" \ |
569 | "\n -t List" \ | 573 | "\n -t List" \ |
570 | "\n -i Extract" \ | 574 | "\n -i Extract" \ |
@@ -572,7 +576,7 @@ | |||
572 | "\n -o Create" \ | 576 | "\n -o Create" \ |
573 | ) \ | 577 | ) \ |
574 | IF_FEATURE_CPIO_P( \ | 578 | IF_FEATURE_CPIO_P( \ |
575 | "\n -p Passthrough" \ | 579 | "\n -p DIR Copy files to DIR" \ |
576 | ) \ | 580 | ) \ |
577 | "\nOptions:" \ | 581 | "\nOptions:" \ |
578 | "\n -d Make leading directories" \ | 582 | "\n -d Make leading directories" \ |