aboutsummaryrefslogtreecommitdiff
path: root/archival/tar.c
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2001-10-24 05:00:29 +0000
committerEric Andersen <andersen@codepoet.org>2001-10-24 05:00:29 +0000
commitbdfd0d78bc44e73d693510e70087857785b3b521 (patch)
tree153a573095afac8d8d0ea857759ecabd77fb28b7 /archival/tar.c
parent9260fc5552a3ee52eb95823aa6689d52a1ffd33c (diff)
downloadbusybox-w32-bdfd0d78bc44e73d693510e70087857785b3b521.tar.gz
busybox-w32-bdfd0d78bc44e73d693510e70087857785b3b521.tar.bz2
busybox-w32-bdfd0d78bc44e73d693510e70087857785b3b521.zip
Major rework of the directory structure and the entire build system.
-Erik
Diffstat (limited to 'archival/tar.c')
-rw-r--r--archival/tar.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/archival/tar.c b/archival/tar.c
index f7a3da66f..9e38eea75 100644
--- a/archival/tar.c
+++ b/archival/tar.c
@@ -9,8 +9,8 @@
9 * ground up. It still has remnents of the old code lying about, but it is 9 * ground up. It still has remnents of the old code lying about, but it is
10 * very different now (i.e., cleaner, less global variables, etc.) 10 * very different now (i.e., cleaner, less global variables, etc.)
11 * 11 *
12 * Copyright (C) 1999,2000,2001 by Lineo, inc. 12 * Copyright (C) 1999,2000 by Lineo, inc. and Erik Andersen
13 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org> 13 * Copyright (C) 1999,2000,2001 by Erik Andersen <andersee@debian.org>
14 * 14 *
15 * Based in part in the tar implementation in sash 15 * Based in part in the tar implementation in sash
16 * Copyright (c) 1999 by David I. Bell 16 * Copyright (c) 1999 by David I. Bell
@@ -49,7 +49,7 @@
49#include <errno.h> 49#include <errno.h>
50#include "busybox.h" 50#include "busybox.h"
51 51
52#ifdef BB_FEATURE_TAR_CREATE 52#ifdef CONFIG_FEATURE_TAR_CREATE
53 53
54/* Tar file constants */ 54/* Tar file constants */
55# define TAR_MAGIC "ustar" /* ustar and a null */ 55# define TAR_MAGIC "ustar" /* ustar and a null */
@@ -395,11 +395,11 @@ static int writeFileToTarball(const char *fileName, struct stat *statbuf, void*
395 if (header_name[0] == '\0') 395 if (header_name[0] == '\0')
396 return TRUE; 396 return TRUE;
397 397
398# if defined BB_FEATURE_TAR_EXCLUDE 398# if defined CONFIG_FEATURE_TAR_EXCLUDE
399 if (exclude_file(tbInfo->excludeList, header_name)) { 399 if (exclude_file(tbInfo->excludeList, header_name)) {
400 return SKIP; 400 return SKIP;
401 } 401 }
402# endif //BB_FEATURE_TAR_EXCLUDE 402# endif //CONFIG_FEATURE_TAR_EXCLUDE
403 403
404 if (writeTarHeader(tbInfo, header_name, fileName, statbuf)==FALSE) { 404 if (writeTarHeader(tbInfo, header_name, fileName, statbuf)==FALSE) {
405 return( FALSE); 405 return( FALSE);
@@ -527,7 +527,7 @@ void append_file_list_to_list(char *filename, char ***name_list, int *num_of_ent
527 fclose(src_stream); 527 fclose(src_stream);
528} 528}
529 529
530#ifdef BB_FEATURE_TAR_EXCLUDE 530#ifdef CONFIG_FEATURE_TAR_EXCLUDE
531/* 531/*
532 * Create a list of names that are in the include list AND NOT in the exclude lists 532 * Create a list of names that are in the include list AND NOT in the exclude lists
533 */ 533 */
@@ -626,7 +626,7 @@ int tar_main(int argc, char **argv)
626 626
627 /* These are optional */ 627 /* These are optional */
628 /* Exclude or Include files listed in <filename>*/ 628 /* Exclude or Include files listed in <filename>*/
629#ifdef BB_FEATURE_TAR_EXCLUDE 629#ifdef CONFIG_FEATURE_TAR_EXCLUDE
630 case 'X': 630 case 'X':
631 append_file_list_to_list(optarg, &exclude_list, &exclude_list_count); 631 append_file_list_to_list(optarg, &exclude_list, &exclude_list_count);
632 break; 632 break;
@@ -660,7 +660,7 @@ int tar_main(int argc, char **argv)
660 } 660 }
661 extract_function |= extract_list; 661 extract_function |= extract_list;
662 break; 662 break;
663#ifdef BB_FEATURE_TAR_GZIP 663#ifdef CONFIG_FEATURE_TAR_GZIP
664 case 'z': 664 case 'z':
665 untar_funct |= untar_unzip; 665 untar_funct |= untar_unzip;
666 break; 666 break;
@@ -698,43 +698,43 @@ int tar_main(int argc, char **argv)
698 } else { 698 } else {
699 src_stream = stdin; 699 src_stream = stdin;
700 } 700 }
701#ifdef BB_FEATURE_TAR_GZIP 701#ifdef CONFIG_FEATURE_TAR_GZIP
702 /* Get a binary tree of all the tar file headers */ 702 /* Get a binary tree of all the tar file headers */
703 if (untar_funct & untar_unzip) { 703 if (untar_funct & untar_unzip) {
704 uncompressed_stream = gz_open(src_stream, &gunzip_pid); 704 uncompressed_stream = gz_open(src_stream, &gunzip_pid);
705 } else 705 } else
706#endif // BB_FEATURE_TAR_GZIP 706#endif // CONFIG_FEATURE_TAR_GZIP
707 uncompressed_stream = src_stream; 707 uncompressed_stream = src_stream;
708 708
709 /* extract or list archive */ 709 /* extract or list archive */
710 unarchive(uncompressed_stream, stdout, &get_header_tar, extract_function, dst_prefix, include_list, exclude_list); 710 unarchive(uncompressed_stream, stdout, &get_header_tar, extract_function, dst_prefix, include_list, exclude_list);
711 fclose(uncompressed_stream); 711 fclose(uncompressed_stream);
712 } 712 }
713#ifdef BB_FEATURE_TAR_CREATE 713#ifdef CONFIG_FEATURE_TAR_CREATE
714 /* create an archive */ 714 /* create an archive */
715 else if (untar_funct & untar_create) { 715 else if (untar_funct & untar_create) {
716 int verboseFlag = FALSE; 716 int verboseFlag = FALSE;
717 717
718#ifdef BB_FEATURE_TAR_GZIP 718#ifdef CONFIG_FEATURE_TAR_GZIP
719 if (untar_funct && untar_unzip) { 719 if (untar_funct && untar_unzip) {
720 error_msg_and_die("Creation of compressed tarfile not internally support by tar, pipe to busybox gunzip"); 720 error_msg_and_die("Creation of compressed tarfile not internally support by tar, pipe to busybox gunzip");
721 } 721 }
722#endif // BB_FEATURE_TAR_GZIP 722#endif // CONFIG_FEATURE_TAR_GZIP
723 if (extract_function & extract_verbose_list) { 723 if (extract_function & extract_verbose_list) {
724 verboseFlag = TRUE; 724 verboseFlag = TRUE;
725 } 725 }
726 writeTarFile(src_filename, verboseFlag, &argv[argc - 1], include_list); 726 writeTarFile(src_filename, verboseFlag, &argv[argc - 1], include_list);
727 } 727 }
728#endif // BB_FEATURE_TAR_CREATE 728#endif // CONFIG_FEATURE_TAR_CREATE
729 729
730 /* Cleanups */ 730 /* Cleanups */
731#ifdef BB_FEATURE_TAR_GZIP 731#ifdef CONFIG_FEATURE_TAR_GZIP
732 if (untar_funct & untar_unzip) { 732 if (untar_funct & untar_unzip) {
733 fclose(src_stream); 733 fclose(src_stream);
734 close(gz_fd); 734 close(gz_fd);
735 gz_close(gunzip_pid); 735 gz_close(gunzip_pid);
736 } 736 }
737#endif // BB_FEATURE_TAR_GZIP 737#endif // CONFIG_FEATURE_TAR_GZIP
738 if (src_filename) { 738 if (src_filename) {
739 free(src_filename); 739 free(src_filename);
740 } 740 }