diff options
author | Glenn L McGrath <bug1@ihug.co.nz> | 2003-11-18 21:37:52 +0000 |
---|---|---|
committer | Glenn L McGrath <bug1@ihug.co.nz> | 2003-11-18 21:37:52 +0000 |
commit | 56f16b42c93af18fbb984e8d6384c03e5405e3ae (patch) | |
tree | d0b1d8100cd6857681145fa4e40b05fb542d35ae /archival/tar.c | |
parent | 20872be9a4e670666b307f94b8fca6bf807c9b7b (diff) | |
download | busybox-w32-56f16b42c93af18fbb984e8d6384c03e5405e3ae.tar.gz busybox-w32-56f16b42c93af18fbb984e8d6384c03e5405e3ae.tar.bz2 busybox-w32-56f16b42c93af18fbb984e8d6384c03e5405e3ae.zip |
tar -Z, uncompress support
Diffstat (limited to 'archival/tar.c')
-rw-r--r-- | archival/tar.c | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/archival/tar.c b/archival/tar.c index 7516b5752..4e763a404 100644 --- a/archival/tar.c +++ b/archival/tar.c | |||
@@ -594,8 +594,27 @@ static llist_t *append_file_list_to_list(llist_t *list) | |||
594 | } | 594 | } |
595 | #endif | 595 | #endif |
596 | 596 | ||
597 | #ifdef CONFIG_FEATURE_TAR_COMPRESS | ||
598 | static char get_header_tar_Z(archive_handle_t *archive_handle) | ||
599 | { | ||
600 | /* Cant lseek over pipe's */ | ||
601 | archive_handle->seek = seek_by_char; | ||
602 | |||
603 | /* do the decompression, and cleanup */ | ||
604 | if ((bb_xread_char(archive_handle->src_fd) != 0x1f) || (bb_xread_char(archive_handle->src_fd) != 0x9d)) { | ||
605 | bb_error_msg_and_die("Invalid magic"); | ||
606 | } | ||
597 | 607 | ||
598 | static const char tar_options[]="ctxjT:X:C:f:Opvzk"; | 608 | archive_handle->src_fd = open_transformer(archive_handle->src_fd, uncompress); |
609 | archive_handle->offset = 0; | ||
610 | while (get_header_tar(archive_handle) == EXIT_SUCCESS); | ||
611 | |||
612 | /* Can only do one file at a time */ | ||
613 | return(EXIT_FAILURE); | ||
614 | } | ||
615 | #endif | ||
616 | |||
617 | static const char tar_options[]="ctxjT:X:C:f:OpvzkZ"; | ||
599 | 618 | ||
600 | #define CTX_CREATE 1 | 619 | #define CTX_CREATE 1 |
601 | #define CTX_TEST 2 | 620 | #define CTX_TEST 2 |
@@ -610,6 +629,7 @@ static const char tar_options[]="ctxjT:X:C:f:Opvzk"; | |||
610 | #define TAR_OPT_VERBOSE 1024 | 629 | #define TAR_OPT_VERBOSE 1024 |
611 | #define TAR_OPT_GZIP 2048 | 630 | #define TAR_OPT_GZIP 2048 |
612 | #define TAR_OPT_KEEP_OLD 4096 | 631 | #define TAR_OPT_KEEP_OLD 4096 |
632 | #define TAR_OPT_UNCOMPRESS 8192 | ||
613 | 633 | ||
614 | int tar_main(int argc, char **argv) | 634 | int tar_main(int argc, char **argv) |
615 | { | 635 | { |
@@ -690,6 +710,13 @@ int tar_main(int argc, char **argv) | |||
690 | bb_show_usage(); | 710 | bb_show_usage(); |
691 | #endif | 711 | #endif |
692 | } | 712 | } |
713 | if(opt & TAR_OPT_UNCOMPRESS) { | ||
714 | #ifdef CONFIG_FEATURE_TAR_COMPRESS | ||
715 | get_header_ptr = get_header_tar_Z; | ||
716 | #else | ||
717 | bb_show_usage(); | ||
718 | #endif | ||
719 | } | ||
693 | if(opt & TAR_OPT_EXCLUDE) { | 720 | if(opt & TAR_OPT_EXCLUDE) { |
694 | #ifdef CONFIG_FEATURE_TAR_EXCLUDE | 721 | #ifdef CONFIG_FEATURE_TAR_EXCLUDE |
695 | tar_handle->reject = append_file_list_to_list(tar_handle->reject); | 722 | tar_handle->reject = append_file_list_to_list(tar_handle->reject); |