[BusyBox-cvs] busybox/archival Config.in, 1.11, 1.12 tar.c, 1.180, 1.181

Glenn McGrath bug1 at busybox.net
Tue Nov 18 21:37:54 UTC 2003


Update of /var/cvs/busybox/archival
In directory winder:/tmp/cvs-serv19002/archival

Modified Files:
	Config.in tar.c 
Log Message:
tar -Z, uncompress support


Index: Config.in
===================================================================
RCS file: /var/cvs/busybox/archival/Config.in,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- Config.in	29 Oct 2003 04:46:30 -0000	1.11
+++ Config.in	18 Nov 2003 21:37:50 -0000	1.12
@@ -193,6 +193,14 @@
 	  If you enable this option tar will be able to call gzip,
 	  when creating or extracting tar gziped archives.
 
+config CONFIG_FEATURE_TAR_COMPRESS
+	bool "  Enable -Z option"
+	default n
+	depends on CONFIG_TAR
+	help
+	  If you enable this option tar will be able to call uncompress,
+	  when extracting .tar.Z archives.
+
 config CONFIG_FEATURE_TAR_OLDGNU_COMPATABILITY
 	bool "  Enable support for old tar header format"
 	default N

Index: tar.c
===================================================================
RCS file: /var/cvs/busybox/archival/tar.c,v
retrieving revision 1.180
retrieving revision 1.181
diff -u -d -r1.180 -r1.181
--- tar.c	18 Nov 2003 20:23:04 -0000	1.180
+++ tar.c	18 Nov 2003 21:37:50 -0000	1.181
@@ -594,8 +594,27 @@
 }
 #endif
 
+#ifdef CONFIG_FEATURE_TAR_COMPRESS
+static char get_header_tar_Z(archive_handle_t *archive_handle)
+{
+	/* Cant lseek over pipe's */
+	archive_handle->seek = seek_by_char;
 
-static const char tar_options[]="ctxjT:X:C:f:Opvzk";
+	/* do the decompression, and cleanup */
+	if ((bb_xread_char(archive_handle->src_fd) != 0x1f) || (bb_xread_char(archive_handle->src_fd) != 0x9d)) {
+		bb_error_msg_and_die("Invalid magic");
+	}
+
+	archive_handle->src_fd = open_transformer(archive_handle->src_fd, uncompress);
+	archive_handle->offset = 0;
+	while (get_header_tar(archive_handle) == EXIT_SUCCESS);
+
+	/* Can only do one file at a time */
+	return(EXIT_FAILURE);
+}
+#endif
+
+static const char tar_options[]="ctxjT:X:C:f:OpvzkZ";
 
 #define CTX_CREATE	1
 #define CTX_TEST	2
@@ -610,6 +629,7 @@
 #define TAR_OPT_VERBOSE  1024
 #define TAR_OPT_GZIP     2048
 #define TAR_OPT_KEEP_OLD	4096
+#define TAR_OPT_UNCOMPRESS	8192
 
 int tar_main(int argc, char **argv)
 {
@@ -690,6 +710,13 @@
 		bb_show_usage();
 #endif
 	}
+	if(opt & TAR_OPT_UNCOMPRESS) {
+#ifdef CONFIG_FEATURE_TAR_COMPRESS
+		get_header_ptr = get_header_tar_Z;
+#else
+		bb_show_usage();
+#endif
+	}
 	if(opt & TAR_OPT_EXCLUDE) {
 #ifdef CONFIG_FEATURE_TAR_EXCLUDE
 		tar_handle->reject = append_file_list_to_list(tar_handle->reject);




More information about the busybox-cvs mailing list