aboutsummaryrefslogtreecommitdiff
path: root/tar.c
diff options
context:
space:
mode:
authorbug1 <bug1@69ca8d6d-28ef-0310-b511-8ec308f3f277>2001-03-28 07:27:26 +0000
committerbug1 <bug1@69ca8d6d-28ef-0310-b511-8ec308f3f277>2001-03-28 07:27:26 +0000
commit37988d76d9d49c16477186f5c584890cf23edf8c (patch)
tree6d33d3c39b838f96cd47b0247b1696f9337d87b1 /tar.c
parentef8579cc92a7701488628f5cc4484a34a611cdec (diff)
downloadbusybox-w32-37988d76d9d49c16477186f5c584890cf23edf8c.tar.gz
busybox-w32-37988d76d9d49c16477186f5c584890cf23edf8c.tar.bz2
busybox-w32-37988d76d9d49c16477186f5c584890cf23edf8c.zip
Fix tar -z, calls gz_open now
git-svn-id: svn://busybox.net/trunk/busybox@2211 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'tar.c')
-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