summaryrefslogtreecommitdiff
path: root/archival
diff options
context:
space:
mode:
authorGlenn L McGrath <bug1@ihug.co.nz>2003-11-18 21:37:52 +0000
committerGlenn L McGrath <bug1@ihug.co.nz>2003-11-18 21:37:52 +0000
commit56f16b42c93af18fbb984e8d6384c03e5405e3ae (patch)
treed0b1d8100cd6857681145fa4e40b05fb542d35ae /archival
parent20872be9a4e670666b307f94b8fca6bf807c9b7b (diff)
downloadbusybox-w32-56f16b42c93af18fbb984e8d6384c03e5405e3ae.tar.gz
busybox-w32-56f16b42c93af18fbb984e8d6384c03e5405e3ae.tar.bz2
busybox-w32-56f16b42c93af18fbb984e8d6384c03e5405e3ae.zip
tar -Z, uncompress support
Diffstat (limited to 'archival')
-rw-r--r--archival/Config.in8
-rw-r--r--archival/libunarchive/Makefile.in1
-rw-r--r--archival/libunarchive/decompress_uncompress.c5
-rw-r--r--archival/libunarchive/uncompress.c5
-rw-r--r--archival/tar.c29
5 files changed, 37 insertions, 11 deletions
diff --git a/archival/Config.in b/archival/Config.in
index 8859bb137..2eab5abfa 100644
--- a/archival/Config.in
+++ b/archival/Config.in
@@ -193,6 +193,14 @@ config CONFIG_FEATURE_TAR_GZIP
193 If you enable this option tar will be able to call gzip, 193 If you enable this option tar will be able to call gzip,
194 when creating or extracting tar gziped archives. 194 when creating or extracting tar gziped archives.
195 195
196config CONFIG_FEATURE_TAR_COMPRESS
197 bool " Enable -Z option"
198 default n
199 depends on CONFIG_TAR
200 help
201 If you enable this option tar will be able to call uncompress,
202 when extracting .tar.Z archives.
203
196config CONFIG_FEATURE_TAR_OLDGNU_COMPATABILITY 204config CONFIG_FEATURE_TAR_OLDGNU_COMPATABILITY
197 bool " Enable support for old tar header format" 205 bool " Enable support for old tar header format"
198 default N 206 default N
diff --git a/archival/libunarchive/Makefile.in b/archival/libunarchive/Makefile.in
index d449c193e..14ceea110 100644
--- a/archival/libunarchive/Makefile.in
+++ b/archival/libunarchive/Makefile.in
@@ -73,6 +73,7 @@ LIBUNARCHIVE-$(CONFIG_RPM) += $(GUNZIP_FILES) get_header_cpio.o
73LIBUNARCHIVE-$(CONFIG_TAR) += get_header_tar.o 73LIBUNARCHIVE-$(CONFIG_TAR) += get_header_tar.o
74LIBUNARCHIVE-$(CONFIG_FEATURE_TAR_BZIP2) += decompress_bunzip2.o get_header_tar_bz2.o 74LIBUNARCHIVE-$(CONFIG_FEATURE_TAR_BZIP2) += decompress_bunzip2.o get_header_tar_bz2.o
75LIBUNARCHIVE-$(CONFIG_FEATURE_TAR_GZIP) += $(GUNZIP_FILES) get_header_tar_gz.o 75LIBUNARCHIVE-$(CONFIG_FEATURE_TAR_GZIP) += $(GUNZIP_FILES) get_header_tar_gz.o
76LIBUNARCHIVE-$(CONFIG_FEATURE_TAR_COMPRESS) += uncompress.o
76LIBUNARCHIVE-$(CONFIG_UNCOMPRESS) += uncompress.o 77LIBUNARCHIVE-$(CONFIG_UNCOMPRESS) += uncompress.o
77LIBUNARCHIVE-$(CONFIG_UNZIP) += $(GUNZIP_FILES) 78LIBUNARCHIVE-$(CONFIG_UNZIP) += $(GUNZIP_FILES)
78 79
diff --git a/archival/libunarchive/decompress_uncompress.c b/archival/libunarchive/decompress_uncompress.c
index 9851ca39d..5046e8a26 100644
--- a/archival/libunarchive/decompress_uncompress.c
+++ b/archival/libunarchive/decompress_uncompress.c
@@ -1,8 +1,6 @@
1#include "config.h" 1#include "config.h"
2#include "libbb.h" 2#include "libbb.h"
3 3
4#if defined CONFIG_UNCOMPRESS || defined CONFIG_FEATURE_GUNZIP_UNCOMPRESS
5
6/* uncompress for busybox -- (c) 2002 Robert Griebl 4/* uncompress for busybox -- (c) 2002 Robert Griebl
7 * 5 *
8 * based on the original compress42.c source 6 * based on the original compress42.c source
@@ -293,6 +291,3 @@ extern int uncompress(int fd_in, int fd_out)
293 291
294 return 0; 292 return 0;
295} 293}
296
297
298#endif
diff --git a/archival/libunarchive/uncompress.c b/archival/libunarchive/uncompress.c
index 9851ca39d..5046e8a26 100644
--- a/archival/libunarchive/uncompress.c
+++ b/archival/libunarchive/uncompress.c
@@ -1,8 +1,6 @@
1#include "config.h" 1#include "config.h"
2#include "libbb.h" 2#include "libbb.h"
3 3
4#if defined CONFIG_UNCOMPRESS || defined CONFIG_FEATURE_GUNZIP_UNCOMPRESS
5
6/* uncompress for busybox -- (c) 2002 Robert Griebl 4/* uncompress for busybox -- (c) 2002 Robert Griebl
7 * 5 *
8 * based on the original compress42.c source 6 * based on the original compress42.c source
@@ -293,6 +291,3 @@ extern int uncompress(int fd_in, int fd_out)
293 291
294 return 0; 292 return 0;
295} 293}
296
297
298#endif
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
598static 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
598static 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
617static 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
614int tar_main(int argc, char **argv) 634int 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);