Fix exclude list handling

This commit is contained in:
Glenn L McGrath 2001-08-04 05:28:29 +00:00
parent 0b7d70c822
commit b373a8d0ca

View File

@ -230,24 +230,35 @@ char *unarchive(FILE *src_stream, FILE *out_stream, file_header_t *(*get_headers
const int extract_function, const char *prefix, char **extract_names) const int extract_function, const char *prefix, char **extract_names)
{ {
file_header_t *file_entry; file_header_t *file_entry;
int found; int extract_flag;
int i; int i;
char *buffer = NULL; char *buffer = NULL;
archive_offset = 0; archive_offset = 0;
while ((file_entry = get_headers(src_stream)) != NULL) { while ((file_entry = get_headers(src_stream)) != NULL) {
found = FALSE; extract_flag = TRUE;
if (extract_names == NULL) { if (extract_names != NULL) {
found = TRUE; int found_flag = FALSE;
} else {
for(i = 0; extract_names[i] != 0; i++) { for(i = 0; extract_names[i] != 0; i++) {
if (strcmp(extract_names[i], file_entry->name) == 0) { if (strcmp(extract_names[i], file_entry->name) == 0) {
found = TRUE; found_flag = TRUE;
break;
} }
} }
if (extract_function & extract_exclude_list) {
if (found_flag == TRUE) {
extract_flag = FALSE;
}
} else {
/* If its not found in the include list dont extract it */
if (found_flag == FALSE) {
extract_flag = FALSE;
}
}
} }
if (found) { if (extract_flag == TRUE) {
buffer = extract_archive(src_stream, out_stream, file_entry, extract_function, prefix); buffer = extract_archive(src_stream, out_stream, file_entry, extract_function, prefix);
} else { } else {
/* seek past the data entry */ /* seek past the data entry */