unarchive function changed to support both exclude and include lists, applets that use unarchive changed to match.
diff --git a/archival/ar.c b/archival/ar.c
index 7f3396c..e02b265 100644
--- a/archival/ar.c
+++ b/archival/ar.c
@@ -84,6 +84,6 @@
optind++;
}
- unarchive(src_stream, stdout, &get_header_ar, extract_function, "./", extract_names);
+ unarchive(src_stream, stdout, &get_header_ar, extract_function, "./", extract_names, NULL);
return EXIT_SUCCESS;
}
diff --git a/archival/cpio.c b/archival/cpio.c
index 7f68715..372f9f5 100644
--- a/archival/cpio.c
+++ b/archival/cpio.c
@@ -86,7 +86,7 @@
optind++;
}
- unarchive(src_stream, stdout, &get_header_cpio, extract_function, "./", extract_names);
+ unarchive(src_stream, stdout, &get_header_cpio, extract_function, "./", extract_names, NULL);
if (oldmask) {
umask(oldmask); /* Restore umask if we changed it */
}
diff --git a/archival/tar.c b/archival/tar.c
index 1f8eb4b..f7a3da6 100644
--- a/archival/tar.c
+++ b/archival/tar.c
@@ -580,15 +580,10 @@
untar_extract = 32
};
-#ifdef BB_FEATURE_TAR_EXCLUDE
- char **exclude_list = NULL;
- int exclude_list_count = 0;
-#endif
-
FILE *src_stream = NULL;
FILE *uncompressed_stream = NULL;
char **include_list = NULL;
- char **the_real_list = NULL;
+ char **exclude_list = NULL;
char *src_filename = NULL;
char *dst_prefix = NULL;
char *file_list_name = NULL;
@@ -597,6 +592,7 @@
unsigned short untar_funct_required = 0;
unsigned short extract_function = 0;
int include_list_count = 0;
+ int exclude_list_count = 0;
int gunzip_pid;
int gz_fd = 0;
@@ -691,25 +687,6 @@
optind++;
}
- /* By default the include list is the list we act on */
- the_real_list = include_list;
-
-#ifdef BB_FEATURE_TAR_EXCLUDE
- if (exclude_list != NULL) {
- if (include_list == NULL) {
- /* the_real_list is an exclude list */
- extract_function |= extract_exclude_list;
- the_real_list = exclude_list;
- } else {
- /* Both an exclude and include file list was present,
- * its an exclude from include list only.
- * Remove excluded files from the include list
- */
- the_real_list = list_and_not_list(include_list, exclude_list);
- }
- }
-#endif
-
if (extract_function & (extract_list | extract_all_to_fs)) {
if (dst_prefix == NULL) {
dst_prefix = xstrdup("./");
@@ -730,7 +707,7 @@
uncompressed_stream = src_stream;
/* extract or list archive */
- unarchive(uncompressed_stream, stdout, &get_header_tar, extract_function, dst_prefix, the_real_list);
+ unarchive(uncompressed_stream, stdout, &get_header_tar, extract_function, dst_prefix, include_list, exclude_list);
fclose(uncompressed_stream);
}
#ifdef BB_FEATURE_TAR_CREATE
@@ -746,7 +723,7 @@
if (extract_function & extract_verbose_list) {
verboseFlag = TRUE;
}
- writeTarFile(src_filename, verboseFlag, &argv[argc - 1], the_real_list);
+ writeTarFile(src_filename, verboseFlag, &argv[argc - 1], include_list);
}
#endif // BB_FEATURE_TAR_CREATE