summaryrefslogtreecommitdiff
path: root/archival/cpio.c
diff options
context:
space:
mode:
authorGlenn L McGrath2003-08-28 19:12:23 +0000
committerGlenn L McGrath2003-08-28 19:12:23 +0000
commit4cee66d5a8a49f6bd6342923aff94262812fba73 (patch)
tree8523978e8159ce2569e02557fa2b6ced3030b39b /archival/cpio.c
parent444566837c4b98f364fa486f9f288b0775ed3ed6 (diff)
downloadbusybox-4cee66d5a8a49f6bd6342923aff94262812fba73.zip
busybox-4cee66d5a8a49f6bd6342923aff94262812fba73.tar.gz
Dont unlink when testing !
Always preserve creation date Disable the -p option its for modification date Remove some cpio header debugging noise Syncronise file listing behaviour with upstream.
Diffstat (limited to 'archival/cpio.c')
-rw-r--r--archival/cpio.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/archival/cpio.c b/archival/cpio.c
index 111807c..beee83d 100644
--- a/archival/cpio.c
+++ b/archival/cpio.c
@@ -40,8 +40,8 @@ extern int cpio_main(int argc, char **argv)
archive_handle = init_handle();
archive_handle->src_fd = fileno(stdin);
archive_handle->seek = seek_by_char;
- archive_handle->action_header = header_list;
-
+ archive_handle->flags = ARCHIVE_EXTRACT_NEWER | ARCHIVE_PRESERVE_DATE;
+
while ((opt = getopt(argc, argv, "idmuvtF:")) != -1) {
switch (opt) {
case 'i': /* extract */
@@ -50,17 +50,28 @@ extern int cpio_main(int argc, char **argv)
case 'd': /* create _leading_ directories */
archive_handle->flags |= ARCHIVE_CREATE_LEADING_DIRS;
break;
+#if 0
case 'm': /* preserve modification time */
archive_handle->flags |= ARCHIVE_PRESERVE_DATE;
break;
+#endif
case 'v': /* verbosly list files */
- archive_handle->action_header = header_verbose_list;
+ if (archive_handle->action_header == header_list) {
+ archive_handle->action_header = header_verbose_list;
+ } else {
+ archive_handle->action_header = header_list;
+ }
break;
case 'u': /* unconditional */
archive_handle->flags |= ARCHIVE_EXTRACT_UNCONDITIONAL;
+ archive_handle->flags &= ~ARCHIVE_EXTRACT_NEWER;
break;
case 't': /* list files */
- archive_handle->action_header = header_list;
+ if (archive_handle->action_header == header_list) {
+ archive_handle->action_header = header_verbose_list;
+ } else {
+ archive_handle->action_header = header_list;
+ }
break;
case 'F':
archive_handle->src_fd = bb_xopen(optarg, O_RDONLY);
@@ -81,4 +92,3 @@ extern int cpio_main(int argc, char **argv)
return(EXIT_SUCCESS);
}
-