diff options
author | Glenn L McGrath | 2001-10-13 19:43:46 +0000 |
---|---|---|
committer | Glenn L McGrath | 2001-10-13 19:43:46 +0000 |
commit | 4bef7b41861f02874bce4ac6ab0c8c2484d41d07 (patch) | |
tree | 68cc6368c5bdca2b2d34213bc66b978fd7a26b03 /archival | |
parent | 051eee6ed3056145edeee14d7ab4de9e2f723164 (diff) | |
download | busybox-4bef7b41861f02874bce4ac6ab0c8c2484d41d07.zip busybox-4bef7b41861f02874bce4ac6ab0c8c2484d41d07.tar.gz |
unarchive function changed to support both exclude and include lists, applets that use unarchive changed to match.
Diffstat (limited to 'archival')
-rw-r--r-- | archival/ar.c | 2 | ||||
-rw-r--r-- | archival/cpio.c | 2 | ||||
-rw-r--r-- | archival/tar.c | 31 |
3 files changed, 6 insertions, 29 deletions
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 @@ extern int ar_main(int argc, char **argv) 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 @@ extern int cpio_main(int argc, char **argv) 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 @@ int tar_main(int argc, char **argv) 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 @@ int tar_main(int argc, char **argv) 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 @@ int tar_main(int argc, char **argv) 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 @@ int tar_main(int argc, char **argv) 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 @@ int tar_main(int argc, char **argv) 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 |