summaryrefslogtreecommitdiff
path: root/tar.c
diff options
context:
space:
mode:
authorGlenn L McGrath <bug1@ihug.co.nz>2001-03-28 07:27:26 +0000
committerGlenn L McGrath <bug1@ihug.co.nz>2001-03-28 07:27:26 +0000
commit018e9e6799ec34d2793c7b16f52e39cd9206861b (patch)
tree6d33d3c39b838f96cd47b0247b1696f9337d87b1 /tar.c
parentee79ca1ba69b5b43cd0c2e3b6d2eb20a4a5a0f8e (diff)
downloadbusybox-w32-018e9e6799ec34d2793c7b16f52e39cd9206861b.tar.gz
busybox-w32-018e9e6799ec34d2793c7b16f52e39cd9206861b.tar.bz2
busybox-w32-018e9e6799ec34d2793c7b16f52e39cd9206861b.zip
Fix tar -z, calls gz_open now
Diffstat (limited to '')
-rw-r--r--tar.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/tar.c b/tar.c
index 16b3fb4b6..46321de60 100644
--- a/tar.c
+++ b/tar.c
@@ -58,6 +58,8 @@
58 58
59#ifdef BB_FEATURE_TAR_GZIP 59#ifdef BB_FEATURE_TAR_GZIP
60extern int unzip(int in, int out); 60extern int unzip(int in, int out);
61extern int gz_open(FILE *compressed_file, int *pid);
62extern void gz_close(int gunzip_pid);
61#endif 63#endif
62 64
63/* Tar file constants */ 65/* Tar file constants */
@@ -202,6 +204,7 @@ extern int tar_main(int argc, char **argv)
202 char file[256]; 204 char file[256];
203#endif 205#endif
204#if defined BB_FEATURE_TAR_GZIP 206#if defined BB_FEATURE_TAR_GZIP
207 FILE *comp_file = NULL;
205 int unzipFlag = FALSE; 208 int unzipFlag = FALSE;
206#endif 209#endif
207 int listFlag = FALSE; 210 int listFlag = FALSE;
@@ -211,6 +214,7 @@ extern int tar_main(int argc, char **argv)
211 int tostdoutFlag = FALSE; 214 int tostdoutFlag = FALSE;
212 int status = FALSE; 215 int status = FALSE;
213 int opt; 216 int opt;
217 pid_t pid;
214 218
215 if (argc <= 1) 219 if (argc <= 1)
216 show_usage(); 220 show_usage();
@@ -315,13 +319,25 @@ extern int tar_main(int argc, char **argv)
315 319
316#ifdef BB_FEATURE_TAR_GZIP 320#ifdef BB_FEATURE_TAR_GZIP
317 /* unzip tarFd in a seperate process */ 321 /* unzip tarFd in a seperate process */
318 if (unzipFlag == TRUE) 322 if (unzipFlag == TRUE) {
319 tarFd = tar_unzip_init(tarFd); 323 comp_file = fdopen(tarFd, "r");
324 printf("1\n");
325 if ((tarFd = gz_open(comp_file, &pid)) == EXIT_FAILURE) {
326 error_msg_and_die("Couldnt unzip file");
327 }
328 printf("2\n");
329 }
320#endif 330#endif
321 status = readTarFile(tarFd, extractFlag, listFlag, tostdoutFlag, 331 status = readTarFile(tarFd, extractFlag, listFlag, tostdoutFlag,
322 verboseFlag, extractList, excludeList); 332 verboseFlag, extractList, excludeList);
333 close(tarFd);
323 } 334 }
324 335
336#ifdef BB_FEATURE_TAR_GZIP
337 gz_close(pid);
338 fclose(comp_file);
339#endif
340
325 if (status == TRUE) 341 if (status == TRUE)
326 return EXIT_SUCCESS; 342 return EXIT_SUCCESS;
327 else 343 else