diff options
author | Glenn L McGrath <bug1@ihug.co.nz> | 2001-10-13 19:43:46 +0000 |
---|---|---|
committer | Glenn L McGrath <bug1@ihug.co.nz> | 2001-10-13 19:43:46 +0000 |
commit | 4bef7b41861f02874bce4ac6ab0c8c2484d41d07 (patch) | |
tree | 68cc6368c5bdca2b2d34213bc66b978fd7a26b03 /archival/tar.c | |
parent | 051eee6ed3056145edeee14d7ab4de9e2f723164 (diff) | |
download | busybox-w32-4bef7b41861f02874bce4ac6ab0c8c2484d41d07.tar.gz busybox-w32-4bef7b41861f02874bce4ac6ab0c8c2484d41d07.tar.bz2 busybox-w32-4bef7b41861f02874bce4ac6ab0c8c2484d41d07.zip |
unarchive function changed to support both exclude and include lists, applets that use unarchive changed to match.
Diffstat (limited to 'archival/tar.c')
-rw-r--r-- | archival/tar.c | 31 |
1 files changed, 4 insertions, 27 deletions
diff --git a/archival/tar.c b/archival/tar.c index 1f8eb4bcb..f7a3da66f 100644 --- a/archival/tar.c +++ b/archival/tar.c | |||
@@ -580,15 +580,10 @@ int tar_main(int argc, char **argv) | |||
580 | untar_extract = 32 | 580 | untar_extract = 32 |
581 | }; | 581 | }; |
582 | 582 | ||
583 | #ifdef BB_FEATURE_TAR_EXCLUDE | ||
584 | char **exclude_list = NULL; | ||
585 | int exclude_list_count = 0; | ||
586 | #endif | ||
587 | |||
588 | FILE *src_stream = NULL; | 583 | FILE *src_stream = NULL; |
589 | FILE *uncompressed_stream = NULL; | 584 | FILE *uncompressed_stream = NULL; |
590 | char **include_list = NULL; | 585 | char **include_list = NULL; |
591 | char **the_real_list = NULL; | 586 | char **exclude_list = NULL; |
592 | char *src_filename = NULL; | 587 | char *src_filename = NULL; |
593 | char *dst_prefix = NULL; | 588 | char *dst_prefix = NULL; |
594 | char *file_list_name = NULL; | 589 | char *file_list_name = NULL; |
@@ -597,6 +592,7 @@ int tar_main(int argc, char **argv) | |||
597 | unsigned short untar_funct_required = 0; | 592 | unsigned short untar_funct_required = 0; |
598 | unsigned short extract_function = 0; | 593 | unsigned short extract_function = 0; |
599 | int include_list_count = 0; | 594 | int include_list_count = 0; |
595 | int exclude_list_count = 0; | ||
600 | int gunzip_pid; | 596 | int gunzip_pid; |
601 | int gz_fd = 0; | 597 | int gz_fd = 0; |
602 | 598 | ||
@@ -691,25 +687,6 @@ int tar_main(int argc, char **argv) | |||
691 | optind++; | 687 | optind++; |
692 | } | 688 | } |
693 | 689 | ||
694 | /* By default the include list is the list we act on */ | ||
695 | the_real_list = include_list; | ||
696 | |||
697 | #ifdef BB_FEATURE_TAR_EXCLUDE | ||
698 | if (exclude_list != NULL) { | ||
699 | if (include_list == NULL) { | ||
700 | /* the_real_list is an exclude list */ | ||
701 | extract_function |= extract_exclude_list; | ||
702 | the_real_list = exclude_list; | ||
703 | } else { | ||
704 | /* Both an exclude and include file list was present, | ||
705 | * its an exclude from include list only. | ||
706 | * Remove excluded files from the include list | ||
707 | */ | ||
708 | the_real_list = list_and_not_list(include_list, exclude_list); | ||
709 | } | ||
710 | } | ||
711 | #endif | ||
712 | |||
713 | if (extract_function & (extract_list | extract_all_to_fs)) { | 690 | if (extract_function & (extract_list | extract_all_to_fs)) { |
714 | if (dst_prefix == NULL) { | 691 | if (dst_prefix == NULL) { |
715 | dst_prefix = xstrdup("./"); | 692 | dst_prefix = xstrdup("./"); |
@@ -730,7 +707,7 @@ int tar_main(int argc, char **argv) | |||
730 | uncompressed_stream = src_stream; | 707 | uncompressed_stream = src_stream; |
731 | 708 | ||
732 | /* extract or list archive */ | 709 | /* extract or list archive */ |
733 | unarchive(uncompressed_stream, stdout, &get_header_tar, extract_function, dst_prefix, the_real_list); | 710 | unarchive(uncompressed_stream, stdout, &get_header_tar, extract_function, dst_prefix, include_list, exclude_list); |
734 | fclose(uncompressed_stream); | 711 | fclose(uncompressed_stream); |
735 | } | 712 | } |
736 | #ifdef BB_FEATURE_TAR_CREATE | 713 | #ifdef BB_FEATURE_TAR_CREATE |
@@ -746,7 +723,7 @@ int tar_main(int argc, char **argv) | |||
746 | if (extract_function & extract_verbose_list) { | 723 | if (extract_function & extract_verbose_list) { |
747 | verboseFlag = TRUE; | 724 | verboseFlag = TRUE; |
748 | } | 725 | } |
749 | writeTarFile(src_filename, verboseFlag, &argv[argc - 1], the_real_list); | 726 | writeTarFile(src_filename, verboseFlag, &argv[argc - 1], include_list); |
750 | } | 727 | } |
751 | #endif // BB_FEATURE_TAR_CREATE | 728 | #endif // BB_FEATURE_TAR_CREATE |
752 | 729 | ||