busybox/archival/libunarchive/filter_accept_reject_list.c

26 lines
640 B
C
Raw Normal View History

2002-09-25 08:17:48 +05:30
#include <fnmatch.h>
#include <stdlib.h>
#include "unarchive.h"
/*
* Accept names that are in the accept list
*/
extern char filter_accept_reject_list(const llist_t *accept_list, const llist_t *reject_list, const char *key)
{
2002-10-19 11:49:22 +05:30
const llist_t *accept_entry = find_list_entry(accept_list, key);
const llist_t *reject_entry = find_list_entry(reject_list, key);
2002-09-25 08:17:48 +05:30
/* Fail if an accept list was specified and the key wasnt in there */
2002-10-19 11:49:22 +05:30
if (accept_list && (accept_entry == NULL)) {
2002-09-25 08:17:48 +05:30
return(EXIT_FAILURE);
}
/* If the key is in a reject list fail */
2002-10-19 11:49:22 +05:30
if (reject_entry) {
2002-09-25 08:17:48 +05:30
return(EXIT_FAILURE);
}
2002-10-19 11:49:22 +05:30
/* Accepted */
2002-09-25 08:17:48 +05:30
return(EXIT_SUCCESS);
}