Skip to content
Browse files

Rename archive_matching to archive_match.

  • Loading branch information...
1 parent c535617 commit b4d25a741c58200e1b48c5108140aedf8c1acccc @ggcueroad ggcueroad committed Feb 8, 2012
View
8 Makefile.am
@@ -103,7 +103,7 @@ libarchive_la_SOURCES= \
libarchive/archive_entry_strmode.c \
libarchive/archive_entry_xattr.c \
libarchive/archive_getdate.c \
- libarchive/archive_matching.c \
+ libarchive/archive_match.c \
libarchive/archive_options.c \
libarchive/archive_options_private.h \
libarchive/archive_pathmatch.c \
@@ -260,9 +260,9 @@ libarchive_test_SOURCES= \
libarchive/test/test_archive_clear_error.c \
libarchive/test/test_archive_crypto.c \
libarchive/test/test_archive_getdate.c \
- libarchive/test/test_archive_matching_owner.c \
- libarchive/test/test_archive_matching_path.c \
- libarchive/test/test_archive_matching_time.c \
+ libarchive/test/test_archive_match_owner.c \
+ libarchive/test/test_archive_match_path.c \
+ libarchive/test/test_archive_match_time.c \
libarchive/test/test_archive_pathmatch.c \
libarchive/test/test_archive_read_close_twice.c \
libarchive/test/test_archive_read_close_twice_open_fd.c \
View
12 cpio/cpio.c
@@ -189,7 +189,7 @@ main(int argc, char *argv[])
cpio->bytes_per_block = 512;
cpio->filename = NULL;
- cpio->matching = archive_matching_new();
+ cpio->matching = archive_match_new();
if (cpio->matching == NULL)
lafe_errc(1, 0, "Out of memory");
@@ -226,7 +226,7 @@ main(int argc, char *argv[])
cpio->filename = cpio->argument;
break;
case 'f': /* POSIX 1997 */
- if (archive_matching_exclude_pattern(cpio->matching,
+ if (archive_match_exclude_pattern(cpio->matching,
cpio->argument) != ARCHIVE_OK)
lafe_errc(1, 0, "Error : %s",
archive_error_string(cpio->matching));
@@ -391,7 +391,7 @@ main(int argc, char *argv[])
break;
case 'i':
while (*cpio->argv != NULL) {
- if (archive_matching_include_pattern(cpio->matching,
+ if (archive_match_include_pattern(cpio->matching,
*cpio->argv) != ARCHIVE_OK)
lafe_errc(1, 0, "Error : %s",
archive_error_string(cpio->matching));
@@ -414,7 +414,7 @@ main(int argc, char *argv[])
"Must specify at least one of -i, -o, or -p");
}
- archive_matching_free(cpio->matching);
+ archive_match_free(cpio->matching);
free_cache(cpio->gname_cache);
free_cache(cpio->uname_cache);
return (cpio->return_value);
@@ -880,7 +880,7 @@ mode_in(struct cpio *cpio)
lafe_errc(1, archive_errno(a),
"%s", archive_error_string(a));
}
- if (archive_matching_path_excluded(cpio->matching, entry))
+ if (archive_match_path_excluded(cpio->matching, entry))
continue;
if (cpio->option_rename) {
destpath = cpio_rename(archive_entry_pathname(entry));
@@ -982,7 +982,7 @@ mode_list(struct cpio *cpio)
lafe_errc(1, archive_errno(a),
"%s", archive_error_string(a));
}
- if (archive_matching_path_excluded(cpio->matching, entry))
+ if (archive_match_path_excluded(cpio->matching, entry))
continue;
if (cpio->verbose)
list_item_verbose(cpio, entry);
View
2 libarchive/CMakeLists.txt
@@ -29,7 +29,7 @@ SET(libarchive_SOURCES
archive_entry_strmode.c
archive_entry_xattr.c
archive_getdate.c
- archive_matching.c
+ archive_match.c
archive_options.c
archive_options_private.h
archive_pathmatch.c
View
79 libarchive/archive.h
@@ -773,10 +773,10 @@ __LA_DECL int archive_read_disk_set_behavior(struct archive *,
int flags);
/*
- * Set archive_matching object that will be used in archive_read_disk to
+ * Set archive_match object that will be used in archive_read_disk to
* know whether an entry should be skipped. The callback function
* _excluded_func will be invoked when an entry is skipped by the result
- * of archive_matching.
+ * of archive_match.
*/
__LA_DECL int archive_read_disk_set_matching(struct archive *,
struct archive *_matching, void (*_excluded_func)
@@ -825,104 +825,97 @@ __LA_DECL void archive_copy_error(struct archive *dest,
__LA_DECL int archive_file_count(struct archive *);
/*
- * ARCHIVE_MATCHING API
+ * ARCHIVE_MATCH API
*/
-__LA_DECL struct archive *archive_matching_new(void);
-__LA_DECL int archive_matching_free(struct archive *);
+__LA_DECL struct archive *archive_match_new(void);
+__LA_DECL int archive_match_free(struct archive *);
/*
* Test if archive_entry is excluded.
* This is a convenience function. This is the same as calling all
- * archive_matching_path_excluded, archive_matching_time_excluded
- * and archive_matching_owner_excluded.
+ * archive_match_path_excluded, archive_match_time_excluded
+ * and archive_match_owner_excluded.
*/
-__LA_DECL int archive_matching_excluded(struct archive *,
+__LA_DECL int archive_match_excluded(struct archive *,
struct archive_entry *);
/*
* Test if pathname is excluded. The conditions are set by following functions.
*/
-__LA_DECL int archive_matching_path_excluded(struct archive *,
+__LA_DECL int archive_match_path_excluded(struct archive *,
struct archive_entry *);
/* Add exclusion pathname pattern. */
-__LA_DECL int archive_matching_exclude_pattern(struct archive *,
- const char *);
-__LA_DECL int archive_matching_exclude_pattern_w(struct archive *,
+__LA_DECL int archive_match_exclude_pattern(struct archive *, const char *);
+__LA_DECL int archive_match_exclude_pattern_w(struct archive *,
const wchar_t *);
/* Add inclusion pathname pattern. */
-__LA_DECL int archive_matching_include_pattern(struct archive *,
- const char *);
-__LA_DECL int archive_matching_include_pattern_w(struct archive *,
+__LA_DECL int archive_match_include_pattern(struct archive *, const char *);
+__LA_DECL int archive_match_include_pattern_w(struct archive *,
const wchar_t *);
/*
* How to get statistic information for inclusion patterns.
*/
/* Return the amount number of unmatched inclusion patterns. */
-__LA_DECL int archive_matching_path_unmatched_inclusions(
- struct archive *);
+__LA_DECL int archive_match_path_unmatched_inclusions(struct archive *);
/* Return the pattern of unmatched inclusion with ARCHIVE_OK.
* Return ARCHIVE_EOF if there is no inclusion pattern. */
-__LA_DECL int archive_matching_path_unmatched_inclusions_next(
+__LA_DECL int archive_match_path_unmatched_inclusions_next(
struct archive *, const char **);
-__LA_DECL int archive_matching_path_unmatched_inclusions_next_w(
+__LA_DECL int archive_match_path_unmatched_inclusions_next_w(
struct archive *, const wchar_t **);
/*
* Test if a file is excluded by its time stamp.
* The conditions are set by following functions.
*/
-__LA_DECL int archive_matching_time_excluded(struct archive *,
+__LA_DECL int archive_match_time_excluded(struct archive *,
struct archive_entry *);
/*
* Flags to tell a matching type of time stamps. These are used for
- * following functinos archive_matching_time*().
+ * following functinos.
*/
/* Time flag: mtime to be tested. */
-#define ARCHIVE_MATCHING_MTIME (0x0100)
+#define ARCHIVE_MATCH_MTIME (0x0100)
/* Time flag: ctime to be tested. */
-#define ARCHIVE_MATCHING_CTIME (0x0200)
+#define ARCHIVE_MATCH_CTIME (0x0200)
/* Comparison flag: Match the time if it is newer than. */
-#define ARCHIVE_MATCHING_NEWER (0x0001)
+#define ARCHIVE_MATCH_NEWER (0x0001)
/* Comparison flag: Match the time if it is older than. */
-#define ARCHIVE_MATCHING_OLDER (0x0002)
+#define ARCHIVE_MATCH_OLDER (0x0002)
/* Comparison flag: Match the time if it is equal to. */
-#define ARCHIVE_MATCHING_EQUAL (0x0010)
+#define ARCHIVE_MATCH_EQUAL (0x0010)
/* Set inclusion time. */
-__LA_DECL int archive_matching_include_time(struct archive *, int _flag,
+__LA_DECL int archive_match_include_time(struct archive *, int _flag,
time_t _sec, long _nsec);
/* Set inclusion time by a date string. */
-__LA_DECL int archive_matching_include_date(struct archive *, int _flag,
+__LA_DECL int archive_match_include_date(struct archive *, int _flag,
const char *_datestr);
-__LA_DECL int archive_matching_include_date_w(struct archive *, int _flag,
+__LA_DECL int archive_match_include_date_w(struct archive *, int _flag,
const wchar_t *_datestr);
/* Set inclusion time by a particluar file. */
-__LA_DECL int archive_matching_include_time_pathname(struct archive *,
+__LA_DECL int archive_match_include_file_time(struct archive *,
int _flag, const char *_pathname);
-__LA_DECL int archive_matching_include_time_pathname_w(struct archive *,
+__LA_DECL int archive_match_include_file_time_w(struct archive *,
int _flag, const wchar_t *_pathname);
/* Add exclusion entry. */
-__LA_DECL int archive_matching_exclude_entry(struct archive *,
+__LA_DECL int archive_match_exclude_entry(struct archive *,
int _flag, struct archive_entry *);
/*
* Test if a file is excluded by its uid ,gid, uname or gname.
* The conditions are set by following functions.
*/
-__LA_DECL int archive_matching_owner_excluded(struct archive *,
+__LA_DECL int archive_match_owner_excluded(struct archive *,
struct archive_entry *);
/* Add inclusion uid, gid, uname and gname. */
-__LA_DECL int archive_matching_include_uid(struct archive *,
- int64_t);
-__LA_DECL int archive_matching_include_gid(struct archive *,
- int64_t);
-__LA_DECL int archive_matching_include_uname(struct archive *,
- const char *);
-__LA_DECL int archive_matching_include_uname_w(struct archive *,
+__LA_DECL int archive_match_include_uid(struct archive *, int64_t);
+__LA_DECL int archive_match_include_gid(struct archive *, int64_t);
+__LA_DECL int archive_match_include_uname(struct archive *, const char *);
+__LA_DECL int archive_match_include_uname_w(struct archive *,
const wchar_t *);
-__LA_DECL int archive_matching_include_gname(struct archive *,
- const char *);
-__LA_DECL int archive_matching_include_gname_w(struct archive *,
+__LA_DECL int archive_match_include_gname(struct archive *, const char *);
+__LA_DECL int archive_match_include_gname_w(struct archive *,
const wchar_t *);
#ifdef __cplusplus
View
2 libarchive/archive_check_magic.c
@@ -94,7 +94,7 @@ archive_handle_type_name(unsigned m)
case ARCHIVE_READ_MAGIC: return ("archive_read");
case ARCHIVE_WRITE_DISK_MAGIC: return ("archive_write_disk");
case ARCHIVE_READ_DISK_MAGIC: return ("archive_read_disk");
- case ARCHIVE_MATCHING_MAGIC: return ("archive_matching");
+ case ARCHIVE_MATCH_MAGIC: return ("archive_match");
default: return NULL;
}
}
View
375 libarchive/archive_matching.c → libarchive/archive_match.c
@@ -86,7 +86,7 @@ struct id_array {
#define TIME_IS_SET 2
#define ID_IS_SET 4
-struct archive_matching {
+struct archive_match {
struct archive archive;
/* exclusion/inclusion set flag. */
@@ -129,15 +129,15 @@ struct archive_matching {
struct match_list inclusion_gnames;
};
-static int add_entry(struct archive_matching *, int,
+static int add_entry(struct archive_match *, int,
struct archive_entry *);
-static int add_owner_id(struct archive_matching *, struct id_array *,
+static int add_owner_id(struct archive_match *, struct id_array *,
int64_t);
-static int add_owner_name(struct archive_matching *, struct match_list *,
+static int add_owner_name(struct archive_match *, struct match_list *,
int, const void *);
-static int add_pattern_mbs(struct archive_matching *, struct match_list *,
+static int add_pattern_mbs(struct archive_match *, struct match_list *,
const char *);
-static int add_pattern_wcs(struct archive_matching *, struct match_list *,
+static int add_pattern_wcs(struct archive_match *, struct match_list *,
const wchar_t *);
static int cmp_key_mbs(const struct archive_rb_node *, const void *);
static int cmp_key_wcs(const struct archive_rb_node *, const void *);
@@ -148,36 +148,36 @@ static int cmp_node_wcs(const struct archive_rb_node *,
static void entry_list_add(struct entry_list *, struct match_file *);
static void entry_list_free(struct entry_list *);
static void entry_list_init(struct entry_list *);
-static int error_nomem(struct archive_matching *);
+static int error_nomem(struct archive_match *);
static void match_list_add(struct match_list *, struct match *);
static void match_list_free(struct match_list *);
static void match_list_init(struct match_list *);
-static int match_list_unmatched_inclusions_next(struct archive_matching *,
+static int match_list_unmatched_inclusions_next(struct archive_match *,
struct match_list *, int, const void **);
static int match_owner_id(struct id_array *, int64_t);
#if !defined(_WIN32) || defined(__CYGWIN__)
-static int match_owner_name_mbs(struct archive_matching *,
+static int match_owner_name_mbs(struct archive_match *,
struct match_list *, const char *);
#else
-static int match_owner_name_wcs(struct archive_matching *,
+static int match_owner_name_wcs(struct archive_match *,
struct match_list *, const wchar_t *);
#endif
-static int match_path_exclusion(struct archive_matching *,
+static int match_path_exclusion(struct archive_match *,
struct match *, int, const void *);
-static int match_path_inclusion(struct archive_matching *,
+static int match_path_inclusion(struct archive_match *,
struct match *, int, const void *);
-static int owner_excluded(struct archive_matching *,
+static int owner_excluded(struct archive_match *,
struct archive_entry *);
-static int path_excluded(struct archive_matching *, int, const void *);
-static int set_timefilter(struct archive_matching *, int, time_t, long,
+static int path_excluded(struct archive_match *, int, const void *);
+static int set_timefilter(struct archive_match *, int, time_t, long,
time_t, long);
-static int set_timefilter_pathname_mbs(struct archive_matching *,
+static int set_timefilter_pathname_mbs(struct archive_match *,
int, const char *);
-static int set_timefilter_pathname_wcs(struct archive_matching *,
+static int set_timefilter_pathname_wcs(struct archive_match *,
int, const wchar_t *);
-static int set_time_str(struct archive_matching *, int, const char *);
-static int set_time_str_w(struct archive_matching *, int, const wchar_t *);
-static int time_excluded(struct archive_matching *,
+static int set_time_str(struct archive_match *, int, const char *);
+static int set_time_str_w(struct archive_match *, int, const wchar_t *);
+static int time_excluded(struct archive_match *,
struct archive_entry *);
static int validate_time_flag(struct archive *, int, const char *);
@@ -200,22 +200,22 @@ static const struct archive_rb_tree_ops rb_ops_wcs = {
*/
static int
-error_nomem(struct archive_matching *a)
+error_nomem(struct archive_match *a)
{
archive_set_error(&(a->archive), ENOMEM, "No memory");
a->archive.state = ARCHIVE_STATE_FATAL;
return (ARCHIVE_FATAL);
}
struct archive *
-archive_matching_new(void)
+archive_match_new(void)
{
- struct archive_matching *a;
+ struct archive_match *a;
- a = (struct archive_matching *)calloc(1, sizeof(*a));
+ a = (struct archive_match *)calloc(1, sizeof(*a));
if (a == NULL)
return (NULL);
- a->archive.magic = ARCHIVE_MATCHING_MAGIC;
+ a->archive.magic = ARCHIVE_MATCH_MAGIC;
a->archive.state = ARCHIVE_STATE_NEW;
match_list_init(&(a->inclusions));
match_list_init(&(a->exclusions));
@@ -228,15 +228,15 @@ archive_matching_new(void)
}
int
-archive_matching_free(struct archive *_a)
+archive_match_free(struct archive *_a)
{
- struct archive_matching *a;
+ struct archive_match *a;
if (_a == NULL)
return (ARCHIVE_OK);
- archive_check_magic(_a, ARCHIVE_MATCHING_MAGIC,
- ARCHIVE_STATE_ANY | ARCHIVE_STATE_FATAL, "archive_matching_free");
- a = (struct archive_matching *)_a;
+ archive_check_magic(_a, ARCHIVE_MATCH_MAGIC,
+ ARCHIVE_STATE_ANY | ARCHIVE_STATE_FATAL, "archive_match_free");
+ a = (struct archive_match *)_a;
match_list_free(&(a->inclusions));
match_list_free(&(a->exclusions));
entry_list_free(&(a->entry_list));
@@ -256,15 +256,15 @@ archive_matching_free(struct archive *_a)
* Returns <0 if something error happened.
*/
int
-archive_matching_excluded(struct archive *_a, struct archive_entry *entry)
+archive_match_excluded(struct archive *_a, struct archive_entry *entry)
{
- struct archive_matching *a;
+ struct archive_match *a;
int r;
- archive_check_magic(_a, ARCHIVE_MATCHING_MAGIC,
- ARCHIVE_STATE_NEW, "archive_matching_excluded_ae");
+ archive_check_magic(_a, ARCHIVE_MATCH_MAGIC,
+ ARCHIVE_STATE_NEW, "archive_match_excluded_ae");
- a = (struct archive_matching *)_a;
+ a = (struct archive_match *)_a;
if (entry == NULL) {
archive_set_error(&(a->archive), EINVAL, "entry is NULL");
return (ARCHIVE_FAILED);
@@ -297,14 +297,14 @@ archive_matching_excluded(struct archive *_a, struct archive_entry *entry)
*/
int
-archive_matching_exclude_pattern(struct archive *_a, const char *pattern)
+archive_match_exclude_pattern(struct archive *_a, const char *pattern)
{
- struct archive_matching *a;
+ struct archive_match *a;
int r;
- archive_check_magic(_a, ARCHIVE_MATCHING_MAGIC,
- ARCHIVE_STATE_NEW, "archive_matching_exclude_pattern");
- a = (struct archive_matching *)_a;
+ archive_check_magic(_a, ARCHIVE_MATCH_MAGIC,
+ ARCHIVE_STATE_NEW, "archive_match_exclude_pattern");
+ a = (struct archive_match *)_a;
if (pattern == NULL || *pattern == '\0') {
archive_set_error(&(a->archive), EINVAL, "pattern is empty");
@@ -316,14 +316,14 @@ archive_matching_exclude_pattern(struct archive *_a, const char *pattern)
}
int
-archive_matching_exclude_pattern_w(struct archive *_a, const wchar_t *pattern)
+archive_match_exclude_pattern_w(struct archive *_a, const wchar_t *pattern)
{
- struct archive_matching *a;
+ struct archive_match *a;
int r;
- archive_check_magic(_a, ARCHIVE_MATCHING_MAGIC,
- ARCHIVE_STATE_NEW, "archive_matching_exclude_pattern_w");
- a = (struct archive_matching *)_a;
+ archive_check_magic(_a, ARCHIVE_MATCH_MAGIC,
+ ARCHIVE_STATE_NEW, "archive_match_exclude_pattern_w");
+ a = (struct archive_match *)_a;
if (pattern == NULL || *pattern == L'\0') {
archive_set_error(&(a->archive), EINVAL, "pattern is empty");
@@ -335,14 +335,14 @@ archive_matching_exclude_pattern_w(struct archive *_a, const wchar_t *pattern)
}
int
-archive_matching_include_pattern(struct archive *_a, const char *pattern)
+archive_match_include_pattern(struct archive *_a, const char *pattern)
{
- struct archive_matching *a;
+ struct archive_match *a;
int r;
- archive_check_magic(_a, ARCHIVE_MATCHING_MAGIC,
- ARCHIVE_STATE_NEW, "archive_matching_include_pattern");
- a = (struct archive_matching *)_a;
+ archive_check_magic(_a, ARCHIVE_MATCH_MAGIC,
+ ARCHIVE_STATE_NEW, "archive_match_include_pattern");
+ a = (struct archive_match *)_a;
if (pattern == NULL || *pattern == '\0') {
archive_set_error(&(a->archive), EINVAL, "pattern is empty");
@@ -354,14 +354,14 @@ archive_matching_include_pattern(struct archive *_a, const char *pattern)
}
int
-archive_matching_include_pattern_w(struct archive *_a, const wchar_t *pattern)
+archive_match_include_pattern_w(struct archive *_a, const wchar_t *pattern)
{
- struct archive_matching *a;
+ struct archive_match *a;
int r;
- archive_check_magic(_a, ARCHIVE_MATCHING_MAGIC,
- ARCHIVE_STATE_NEW, "archive_matching_include_pattern_w");
- a = (struct archive_matching *)_a;
+ archive_check_magic(_a, ARCHIVE_MATCH_MAGIC,
+ ARCHIVE_STATE_NEW, "archive_match_include_pattern_w");
+ a = (struct archive_match *)_a;
if (pattern == NULL || *pattern == L'\0') {
archive_set_error(&(a->archive), EINVAL, "pattern is empty");
@@ -380,15 +380,15 @@ archive_matching_include_pattern_w(struct archive *_a, const wchar_t *pattern)
* Returns <0 if something error happened.
*/
int
-archive_matching_path_excluded(struct archive *_a,
+archive_match_path_excluded(struct archive *_a,
struct archive_entry *entry)
{
- struct archive_matching *a;
+ struct archive_match *a;
- archive_check_magic(_a, ARCHIVE_MATCHING_MAGIC,
- ARCHIVE_STATE_NEW, "archive_matching_path_excluded");
+ archive_check_magic(_a, ARCHIVE_MATCH_MAGIC,
+ ARCHIVE_STATE_NEW, "archive_match_path_excluded");
- a = (struct archive_matching *)_a;
+ a = (struct archive_match *)_a;
if (entry == NULL) {
archive_set_error(&(a->archive), EINVAL, "entry is NULL");
return (ARCHIVE_FAILED);
@@ -409,53 +409,53 @@ archive_matching_path_excluded(struct archive *_a,
* Utilty functions to get statistic information for inclusion patterns.
*/
int
-archive_matching_path_unmatched_inclusions(struct archive *_a)
+archive_match_path_unmatched_inclusions(struct archive *_a)
{
- struct archive_matching *a;
+ struct archive_match *a;
- archive_check_magic(_a, ARCHIVE_MATCHING_MAGIC,
- ARCHIVE_STATE_NEW, "archive_matching_unmatched_inclusions");
- a = (struct archive_matching *)_a;
+ archive_check_magic(_a, ARCHIVE_MATCH_MAGIC,
+ ARCHIVE_STATE_NEW, "archive_match_unmatched_inclusions");
+ a = (struct archive_match *)_a;
return (a->inclusions.unmatched_count);
}
int
-archive_matching_path_unmatched_inclusions_next(struct archive *_a,
+archive_match_path_unmatched_inclusions_next(struct archive *_a,
const char **_p)
{
- struct archive_matching *a;
+ struct archive_match *a;
const void *v;
int r;
- archive_check_magic(_a, ARCHIVE_MATCHING_MAGIC,
- ARCHIVE_STATE_NEW, "archive_matching_unmatched_inclusions_next");
- a = (struct archive_matching *)_a;
+ archive_check_magic(_a, ARCHIVE_MATCH_MAGIC,
+ ARCHIVE_STATE_NEW, "archive_match_unmatched_inclusions_next");
+ a = (struct archive_match *)_a;
r = match_list_unmatched_inclusions_next(a, &(a->inclusions), 1, &v);
*_p = (const char *)v;
return (r);
}
int
-archive_matching_path_unmatched_inclusions_next_w(struct archive *_a,
+archive_match_path_unmatched_inclusions_next_w(struct archive *_a,
const wchar_t **_p)
{
- struct archive_matching *a;
+ struct archive_match *a;
const void *v;
int r;
- archive_check_magic(_a, ARCHIVE_MATCHING_MAGIC,
- ARCHIVE_STATE_NEW, "archive_matching_unmatched_inclusions_next_w");
- a = (struct archive_matching *)_a;
+ archive_check_magic(_a, ARCHIVE_MATCH_MAGIC,
+ ARCHIVE_STATE_NEW, "archive_match_unmatched_inclusions_next_w");
+ a = (struct archive_match *)_a;
r = match_list_unmatched_inclusions_next(a, &(a->inclusions), 0, &v);
*_p = (const wchar_t *)v;
return (r);
}
static int
-add_pattern_mbs(struct archive_matching *a, struct match_list *list,
+add_pattern_mbs(struct archive_match *a, struct match_list *list,
const char *pattern)
{
struct match *match;
@@ -475,7 +475,7 @@ add_pattern_mbs(struct archive_matching *a, struct match_list *list,
}
static int
-add_pattern_wcs(struct archive_matching *a, struct match_list *list,
+add_pattern_wcs(struct archive_match *a, struct match_list *list,
const wchar_t *pattern)
{
struct match *match;
@@ -495,7 +495,7 @@ add_pattern_wcs(struct archive_matching *a, struct match_list *list,
}
static int
-path_excluded(struct archive_matching *a, int mbs, const void *pathname)
+path_excluded(struct archive_match *a, int mbs, const void *pathname)
{
struct match *match;
struct match *matched;
@@ -563,7 +563,7 @@ path_excluded(struct archive_matching *a, int mbs, const void *pathname)
*
*/
static int
-match_path_exclusion(struct archive_matching *a, struct match *m,
+match_path_exclusion(struct archive_match *a, struct match *m,
int mbs, const void *pn)
{
int flag = PATHMATCH_NO_ANCHOR_START | PATHMATCH_NO_ANCHOR_END;
@@ -591,7 +591,7 @@ match_path_exclusion(struct archive_matching *a, struct match *m,
* the beginning of the path) even though exclusions are not anchored.
*/
static int
-match_path_inclusion(struct archive_matching *a, struct match *m,
+match_path_inclusion(struct archive_match *a, struct match *m,
int mbs, const void *pn)
{
int flag = PATHMATCH_NO_ANCHOR_END;
@@ -645,7 +645,7 @@ match_list_add(struct match_list *list, struct match *m)
}
static int
-match_list_unmatched_inclusions_next(struct archive_matching *a,
+match_list_unmatched_inclusions_next(struct archive_match *a,
struct match_list *list, int mbs, const void **vp)
{
struct match *m;
@@ -699,80 +699,78 @@ match_list_unmatched_inclusions_next(struct archive_matching *a,
* Utility functions to manage inclusion timestamps.
*/
int
-archive_matching_include_time(struct archive *_a, int flag, time_t sec,
+archive_match_include_time(struct archive *_a, int flag, time_t sec,
long nsec)
{
int r;
- r = validate_time_flag(_a, flag, "archive_matching_include_time");
+ r = validate_time_flag(_a, flag, "archive_match_include_time");
if (r != ARCHIVE_OK)
return (r);
- return set_timefilter((struct archive_matching *)_a, flag,
+ return set_timefilter((struct archive_match *)_a, flag,
sec, nsec, sec, nsec);
}
int
-archive_matching_include_date(struct archive *_a, int flag,
+archive_match_include_date(struct archive *_a, int flag,
const char *datestr)
{
int r;
- r = validate_time_flag(_a, flag, "archive_matching_include_date");
+ r = validate_time_flag(_a, flag, "archive_match_include_date");
if (r != ARCHIVE_OK)
return (r);
- return set_time_str((struct archive_matching *)_a, flag, datestr);
+ return set_time_str((struct archive_match *)_a, flag, datestr);
}
int
-archive_matching_include_date_w(struct archive *_a, int flag,
+archive_match_include_date_w(struct archive *_a, int flag,
const wchar_t *datestr)
{
int r;
- r = validate_time_flag(_a, flag, "archive_matching_include_date_w");
+ r = validate_time_flag(_a, flag, "archive_match_include_date_w");
if (r != ARCHIVE_OK)
return (r);
- return set_time_str_w((struct archive_matching *)_a, flag, datestr);
+ return set_time_str_w((struct archive_match *)_a, flag, datestr);
}
int
-archive_matching_include_time_pathname(struct archive *_a, int flag,
+archive_match_include_file_time(struct archive *_a, int flag,
const char *pathname)
{
int r;
- r = validate_time_flag(_a, flag,
- "archive_matching_include_time_pathname");
+ r = validate_time_flag(_a, flag, "archive_match_include_file_time");
if (r != ARCHIVE_OK)
return (r);
- return set_timefilter_pathname_mbs((struct archive_matching *)_a,
+ return set_timefilter_pathname_mbs((struct archive_match *)_a,
flag, pathname);
}
int
-archive_matching_include_time_pathname_w(struct archive *_a, int flag,
+archive_match_include_file_time_w(struct archive *_a, int flag,
const wchar_t *pathname)
{
int r;
- r = validate_time_flag(_a, flag,
- "archive_matching_include_time_pathname_w");
+ r = validate_time_flag(_a, flag, "archive_match_include_file_time_w");
if (r != ARCHIVE_OK)
return (r);
- return set_timefilter_pathname_wcs((struct archive_matching *)_a,
+ return set_timefilter_pathname_wcs((struct archive_match *)_a,
flag, pathname);
}
int
-archive_matching_exclude_entry(struct archive *_a, int flag,
+archive_match_exclude_entry(struct archive *_a, int flag,
struct archive_entry *entry)
{
- struct archive_matching *a;
+ struct archive_match *a;
- archive_check_magic(_a, ARCHIVE_MATCHING_MAGIC,
- ARCHIVE_STATE_NEW, "archive_matching_time_include_entry");
- a = (struct archive_matching *)_a;
+ archive_check_magic(_a, ARCHIVE_MATCH_MAGIC,
+ ARCHIVE_STATE_NEW, "archive_match_time_include_entry");
+ a = (struct archive_match *)_a;
if (entry == NULL) {
archive_set_error(&(a->archive), EINVAL, "entry is NULL");
@@ -789,15 +787,15 @@ archive_matching_exclude_entry(struct archive *_a, int flag,
* Returns <0 if something error happened.
*/
int
-archive_matching_time_excluded(struct archive *_a,
+archive_match_time_excluded(struct archive *_a,
struct archive_entry *entry)
{
- struct archive_matching *a;
+ struct archive_match *a;
- archive_check_magic(_a, ARCHIVE_MATCHING_MAGIC,
- ARCHIVE_STATE_NEW, "archive_matching_time_excluded_ae");
+ archive_check_magic(_a, ARCHIVE_MATCH_MAGIC,
+ ARCHIVE_STATE_NEW, "archive_match_time_excluded_ae");
- a = (struct archive_matching *)_a;
+ a = (struct archive_match *)_a;
if (entry == NULL) {
archive_set_error(&(a->archive), EINVAL, "entry is NULL");
return (ARCHIVE_FAILED);
@@ -813,67 +811,66 @@ archive_matching_time_excluded(struct archive *_a,
static int
validate_time_flag(struct archive *_a, int flag, const char *_fn)
{
- archive_check_magic(_a, ARCHIVE_MATCHING_MAGIC,
+ archive_check_magic(_a, ARCHIVE_MATCH_MAGIC,
ARCHIVE_STATE_NEW, _fn);
/* Check a type of time. */
if (flag &
- ((~(ARCHIVE_MATCHING_MTIME | ARCHIVE_MATCHING_CTIME)) & 0xff00)) {
+ ((~(ARCHIVE_MATCH_MTIME | ARCHIVE_MATCH_CTIME)) & 0xff00)) {
archive_set_error(_a, EINVAL, "Invalid time flag");
return (ARCHIVE_FAILED);
}
- if ((flag & (ARCHIVE_MATCHING_MTIME | ARCHIVE_MATCHING_CTIME)) == 0) {
+ if ((flag & (ARCHIVE_MATCH_MTIME | ARCHIVE_MATCH_CTIME)) == 0) {
archive_set_error(_a, EINVAL, "No time flag");
return (ARCHIVE_FAILED);
}
/* Check a type of comparison. */
if (flag &
- ((~(ARCHIVE_MATCHING_NEWER | ARCHIVE_MATCHING_OLDER
- | ARCHIVE_MATCHING_EQUAL)) & 0x00ff)) {
+ ((~(ARCHIVE_MATCH_NEWER | ARCHIVE_MATCH_OLDER
+ | ARCHIVE_MATCH_EQUAL)) & 0x00ff)) {
archive_set_error(_a, EINVAL, "Invalid comparison flag");
return (ARCHIVE_FAILED);
}
- if ((flag & (ARCHIVE_MATCHING_NEWER | ARCHIVE_MATCHING_OLDER
- | ARCHIVE_MATCHING_EQUAL)) == 0) {
+ if ((flag & (ARCHIVE_MATCH_NEWER | ARCHIVE_MATCH_OLDER
+ | ARCHIVE_MATCH_EQUAL)) == 0) {
archive_set_error(_a, EINVAL, "No comparison flag");
return (ARCHIVE_FAILED);
}
return (ARCHIVE_OK);
}
-#define JUST_EQUAL(t) (((t) & (ARCHIVE_MATCHING_EQUAL |\
- ARCHIVE_MATCHING_NEWER | ARCHIVE_MATCHING_OLDER))\
- == ARCHIVE_MATCHING_EQUAL)
+#define JUST_EQUAL(t) (((t) & (ARCHIVE_MATCH_EQUAL |\
+ ARCHIVE_MATCH_NEWER | ARCHIVE_MATCH_OLDER)) == ARCHIVE_MATCH_EQUAL)
static int
-set_timefilter(struct archive_matching *a, int timetype,
+set_timefilter(struct archive_match *a, int timetype,
time_t mtime_sec, long mtime_nsec, time_t ctime_sec, long ctime_nsec)
{
- if (timetype & ARCHIVE_MATCHING_MTIME) {
- if ((timetype & ARCHIVE_MATCHING_NEWER) ||
+ if (timetype & ARCHIVE_MATCH_MTIME) {
+ if ((timetype & ARCHIVE_MATCH_NEWER) ||
JUST_EQUAL(timetype)) {
a->newer_mtime_filter = timetype;
a->newer_mtime_sec = mtime_sec;
a->newer_mtime_nsec = mtime_nsec;
a->setflag |= TIME_IS_SET;
}
- if (timetype & ARCHIVE_MATCHING_OLDER) {
+ if (timetype & ARCHIVE_MATCH_OLDER) {
a->older_mtime_filter = timetype;
a->older_mtime_sec = mtime_sec;
a->older_mtime_nsec = mtime_nsec;
a->setflag |= TIME_IS_SET;
}
}
- if (timetype & ARCHIVE_MATCHING_CTIME) {
- if ((timetype & ARCHIVE_MATCHING_NEWER) ||
+ if (timetype & ARCHIVE_MATCH_CTIME) {
+ if ((timetype & ARCHIVE_MATCH_NEWER) ||
JUST_EQUAL(timetype)) {
a->newer_ctime_filter = timetype;
a->newer_ctime_sec = ctime_sec;
a->newer_ctime_nsec = ctime_nsec;
a->setflag |= TIME_IS_SET;
}
- if (timetype & ARCHIVE_MATCHING_OLDER) {
+ if (timetype & ARCHIVE_MATCH_OLDER) {
a->older_ctime_filter = timetype;
a->older_ctime_sec = ctime_sec;
a->older_ctime_nsec = ctime_nsec;
@@ -884,7 +881,7 @@ set_timefilter(struct archive_matching *a, int timetype,
}
static int
-set_time_str(struct archive_matching *a, int timetype, const char *datestr)
+set_time_str(struct archive_match *a, int timetype, const char *datestr)
{
time_t time;
@@ -901,7 +898,7 @@ set_time_str(struct archive_matching *a, int timetype, const char *datestr)
}
static int
-set_time_str_w(struct archive_matching *a, int timetype, const wchar_t *datestr)
+set_time_str_w(struct archive_match *a, int timetype, const wchar_t *datestr)
{
struct archive_string as;
time_t time;
@@ -932,7 +929,7 @@ set_time_str_w(struct archive_matching *a, int timetype, const wchar_t *datestr)
#if defined(_WIN32) && !defined(__CYGWIN__)
#define EPOC_TIME (116444736000000000ui64)
static int
-set_timefilter_find_data(struct archive_matching *a, int timetype,
+set_timefilter_find_data(struct archive_match *a, int timetype,
DWORD ftLastWriteTime_dwHighDateTime, DWORD ftLastWriteTime_dwLowDateTime,
DWORD ftCreationTime_dwHighDateTime, DWORD ftCreationTime_dwLowDateTime)
{
@@ -964,7 +961,7 @@ set_timefilter_find_data(struct archive_matching *a, int timetype,
}
#else
static int
-set_timefilter_stat(struct archive_matching *a, int timetype, struct stat *st)
+set_timefilter_stat(struct archive_match *a, int timetype, struct stat *st)
{
struct archive_entry *ae;
time_t ctime, mtime;
@@ -984,7 +981,7 @@ set_timefilter_stat(struct archive_matching *a, int timetype, struct stat *st)
#endif
static int
-set_timefilter_pathname_mbs(struct archive_matching *a, int timetype,
+set_timefilter_pathname_mbs(struct archive_match *a, int timetype,
const char *path)
{
#if defined(_WIN32) && !defined(__CYGWIN__)
@@ -1023,7 +1020,7 @@ set_timefilter_pathname_mbs(struct archive_matching *a, int timetype,
}
static int
-set_timefilter_pathname_wcs(struct archive_matching *a, int timetype,
+set_timefilter_pathname_wcs(struct archive_match *a, int timetype,
const wchar_t *path)
{
#if defined(_WIN32) && !defined(__CYGWIN__)
@@ -1160,7 +1157,7 @@ entry_list_add(struct entry_list *list, struct match_file *file)
}
static int
-add_entry(struct archive_matching *a, int flag,
+add_entry(struct archive_match *a, int flag,
struct archive_entry *entry)
{
struct match_file *f;
@@ -1230,7 +1227,7 @@ add_entry(struct archive_matching *a, int flag,
}
static int
-time_excluded(struct archive_matching *a, struct archive_entry *entry)
+time_excluded(struct archive_match *a, struct archive_entry *entry)
{
struct match_file *f;
const void *pathname;
@@ -1256,7 +1253,7 @@ time_excluded(struct archive_matching *a, struct archive_entry *entry)
if (nsec < a->newer_ctime_nsec)
return (1); /* Too old, skip it. */
if (nsec == a->newer_ctime_nsec &&
- (a->newer_ctime_filter & ARCHIVE_MATCHING_EQUAL)
+ (a->newer_ctime_filter & ARCHIVE_MATCH_EQUAL)
== 0)
return (1); /* Equal, skip it. */
} else if (JUST_EQUAL(a->newer_ctime_filter))
@@ -1278,7 +1275,7 @@ time_excluded(struct archive_matching *a, struct archive_entry *entry)
if (nsec > a->older_ctime_nsec)
return (1); /* Too new, skip it. */
if (nsec == a->older_ctime_nsec &&
- (a->older_ctime_filter & ARCHIVE_MATCHING_EQUAL)
+ (a->older_ctime_filter & ARCHIVE_MATCH_EQUAL)
== 0)
return (1); /* Eeual, skip it. */
}
@@ -1292,7 +1289,7 @@ time_excluded(struct archive_matching *a, struct archive_entry *entry)
if (nsec < a->newer_mtime_nsec)
return (1); /* Too old, skip it. */
if (nsec == a->newer_mtime_nsec &&
- (a->newer_mtime_filter & ARCHIVE_MATCHING_EQUAL)
+ (a->newer_mtime_filter & ARCHIVE_MATCH_EQUAL)
== 0)
return (1); /* Equal, skip it. */
} else if (JUST_EQUAL(a->newer_mtime_filter))
@@ -1307,7 +1304,7 @@ time_excluded(struct archive_matching *a, struct archive_entry *entry)
if (nsec > a->older_mtime_nsec)
return (1); /* Too new, skip it. */
if (nsec == a->older_mtime_nsec &&
- (a->older_mtime_filter & ARCHIVE_MATCHING_EQUAL)
+ (a->older_mtime_filter & ARCHIVE_MATCH_EQUAL)
== 0)
return (1); /* Equal, skip it. */
}
@@ -1333,43 +1330,43 @@ time_excluded(struct archive_matching *a, struct archive_entry *entry)
if (f == NULL)
return (0);
- if (f->flag & ARCHIVE_MATCHING_CTIME) {
+ if (f->flag & ARCHIVE_MATCH_CTIME) {
sec = archive_entry_ctime(entry);
if (f->ctime_sec > sec) {
- if (f->flag & ARCHIVE_MATCHING_OLDER)
+ if (f->flag & ARCHIVE_MATCH_OLDER)
return (1);
} else if (f->ctime_sec < sec) {
- if (f->flag & ARCHIVE_MATCHING_NEWER)
+ if (f->flag & ARCHIVE_MATCH_NEWER)
return (1);
} else {
nsec = archive_entry_ctime_nsec(entry);
if (f->ctime_nsec > nsec) {
- if (f->flag & ARCHIVE_MATCHING_OLDER)
+ if (f->flag & ARCHIVE_MATCH_OLDER)
return (1);
} else if (f->ctime_nsec < nsec) {
- if (f->flag & ARCHIVE_MATCHING_NEWER)
+ if (f->flag & ARCHIVE_MATCH_NEWER)
return (1);
- } else if (f->flag & ARCHIVE_MATCHING_EQUAL)
+ } else if (f->flag & ARCHIVE_MATCH_EQUAL)
return (1);
}
}
- if (f->flag & ARCHIVE_MATCHING_MTIME) {
+ if (f->flag & ARCHIVE_MATCH_MTIME) {
sec = archive_entry_mtime(entry);
if (f->mtime_sec > sec) {
- if (f->flag & ARCHIVE_MATCHING_OLDER)
+ if (f->flag & ARCHIVE_MATCH_OLDER)
return (1);
} else if (f->mtime_sec < sec) {
- if (f->flag & ARCHIVE_MATCHING_NEWER)
+ if (f->flag & ARCHIVE_MATCH_NEWER)
return (1);
} else {
nsec = archive_entry_mtime_nsec(entry);
if (f->mtime_nsec > nsec) {
- if (f->flag & ARCHIVE_MATCHING_OLDER)
+ if (f->flag & ARCHIVE_MATCH_OLDER)
return (1);
} else if (f->mtime_nsec < nsec) {
- if (f->flag & ARCHIVE_MATCHING_NEWER)
+ if (f->flag & ARCHIVE_MATCH_NEWER)
return (1);
- } else if (f->flag & ARCHIVE_MATCHING_EQUAL)
+ } else if (f->flag & ARCHIVE_MATCH_EQUAL)
return (1);
}
}
@@ -1381,68 +1378,68 @@ time_excluded(struct archive_matching *a, struct archive_entry *entry)
*/
int
-archive_matching_include_uid(struct archive *_a, int64_t uid)
+archive_match_include_uid(struct archive *_a, int64_t uid)
{
- struct archive_matching *a;
+ struct archive_match *a;
- archive_check_magic(_a, ARCHIVE_MATCHING_MAGIC,
- ARCHIVE_STATE_NEW, "archive_matching_include_uid");
- a = (struct archive_matching *)_a;
+ archive_check_magic(_a, ARCHIVE_MATCH_MAGIC,
+ ARCHIVE_STATE_NEW, "archive_match_include_uid");
+ a = (struct archive_match *)_a;
return (add_owner_id(a, &(a->inclusion_uids), uid));
}
int
-archive_matching_include_gid(struct archive *_a, int64_t gid)
+archive_match_include_gid(struct archive *_a, int64_t gid)
{
- struct archive_matching *a;
+ struct archive_match *a;
- archive_check_magic(_a, ARCHIVE_MATCHING_MAGIC,
- ARCHIVE_STATE_NEW, "archive_matching_include_gid");
- a = (struct archive_matching *)_a;
+ archive_check_magic(_a, ARCHIVE_MATCH_MAGIC,
+ ARCHIVE_STATE_NEW, "archive_match_include_gid");
+ a = (struct archive_match *)_a;
return (add_owner_id(a, &(a->inclusion_gids), gid));
}
int
-archive_matching_include_uname(struct archive *_a, const char *uname)
+archive_match_include_uname(struct archive *_a, const char *uname)
{
- struct archive_matching *a;
+ struct archive_match *a;
- archive_check_magic(_a, ARCHIVE_MATCHING_MAGIC,
- ARCHIVE_STATE_NEW, "archive_matching_include_uname");
- a = (struct archive_matching *)_a;
+ archive_check_magic(_a, ARCHIVE_MATCH_MAGIC,
+ ARCHIVE_STATE_NEW, "archive_match_include_uname");
+ a = (struct archive_match *)_a;
return (add_owner_name(a, &(a->inclusion_unames), 1, uname));
}
int
-archive_matching_include_uname_w(struct archive *_a, const wchar_t *uname)
+archive_match_include_uname_w(struct archive *_a, const wchar_t *uname)
{
- struct archive_matching *a;
+ struct archive_match *a;
- archive_check_magic(_a, ARCHIVE_MATCHING_MAGIC,
- ARCHIVE_STATE_NEW, "archive_matching_include_uname_w");
- a = (struct archive_matching *)_a;
+ archive_check_magic(_a, ARCHIVE_MATCH_MAGIC,
+ ARCHIVE_STATE_NEW, "archive_match_include_uname_w");
+ a = (struct archive_match *)_a;
return (add_owner_name(a, &(a->inclusion_unames), 0, uname));
}
int
-archive_matching_include_gname(struct archive *_a, const char *gname)
+archive_match_include_gname(struct archive *_a, const char *gname)
{
- struct archive_matching *a;
+ struct archive_match *a;
- archive_check_magic(_a, ARCHIVE_MATCHING_MAGIC,
- ARCHIVE_STATE_NEW, "archive_matching_include_gname");
- a = (struct archive_matching *)_a;
+ archive_check_magic(_a, ARCHIVE_MATCH_MAGIC,
+ ARCHIVE_STATE_NEW, "archive_match_include_gname");
+ a = (struct archive_match *)_a;
return (add_owner_name(a, &(a->inclusion_gnames), 1, gname));
}
int
-archive_matching_include_gname_w(struct archive *_a, const wchar_t *gname)
+archive_match_include_gname_w(struct archive *_a, const wchar_t *gname)
{
- struct archive_matching *a;
+ struct archive_match *a;
- archive_check_magic(_a, ARCHIVE_MATCHING_MAGIC,
- ARCHIVE_STATE_NEW, "archive_matching_include_gname_w");
- a = (struct archive_matching *)_a;
+ archive_check_magic(_a, ARCHIVE_MATCH_MAGIC,
+ ARCHIVE_STATE_NEW, "archive_match_include_gname_w");
+ a = (struct archive_match *)_a;
return (add_owner_name(a, &(a->inclusion_gnames), 0, gname));
}
@@ -1454,15 +1451,15 @@ archive_matching_include_gname_w(struct archive *_a, const wchar_t *gname)
* Returns <0 if something error happened.
*/
int
-archive_matching_owner_excluded(struct archive *_a,
+archive_match_owner_excluded(struct archive *_a,
struct archive_entry *entry)
{
- struct archive_matching *a;
+ struct archive_match *a;
- archive_check_magic(_a, ARCHIVE_MATCHING_MAGIC,
- ARCHIVE_STATE_NEW, "archive_matching_id_excluded_ae");
+ archive_check_magic(_a, ARCHIVE_MATCH_MAGIC,
+ ARCHIVE_STATE_NEW, "archive_match_id_excluded_ae");
- a = (struct archive_matching *)_a;
+ a = (struct archive_match *)_a;
if (entry == NULL) {
archive_set_error(&(a->archive), EINVAL, "entry is NULL");
return (ARCHIVE_FAILED);
@@ -1476,7 +1473,7 @@ archive_matching_owner_excluded(struct archive *_a,
}
static int
-add_owner_id(struct archive_matching *a, struct id_array *ids, int64_t id)
+add_owner_id(struct archive_match *a, struct id_array *ids, int64_t id)
{
if (ids->count + 1 >= ids->size) {
if (ids->size == 0)
@@ -1508,7 +1505,7 @@ match_owner_id(struct id_array *ids, int64_t id)
}
static int
-add_owner_name(struct archive_matching *a, struct match_list *list,
+add_owner_name(struct archive_match *a, struct match_list *list,
int mbs, const void *name)
{
struct match *match;
@@ -1527,7 +1524,7 @@ add_owner_name(struct archive_matching *a, struct match_list *list,
#if !defined(_WIN32) || defined(__CYGWIN__)
static int
-match_owner_name_mbs(struct archive_matching *a, struct match_list *list,
+match_owner_name_mbs(struct archive_match *a, struct match_list *list,
const char *name)
{
struct match *m;
@@ -1548,7 +1545,7 @@ match_owner_name_mbs(struct archive_matching *a, struct match_list *list,
}
#else
static int
-match_owner_name_wcs(struct archive_matching *a, struct match_list *list,
+match_owner_name_wcs(struct archive_match *a, struct match_list *list,
const wchar_t *name)
{
struct match *m;
@@ -1570,7 +1567,7 @@ match_owner_name_wcs(struct archive_matching *a, struct match_list *list,
#endif
static int
-owner_excluded(struct archive_matching *a, struct archive_entry *entry)
+owner_excluded(struct archive_match *a, struct archive_entry *entry)
{
int r;
View
2 libarchive/archive_private.h
@@ -50,7 +50,7 @@
#define ARCHIVE_READ_MAGIC (0xdeb0c5U)
#define ARCHIVE_WRITE_DISK_MAGIC (0xc001b0c5U)
#define ARCHIVE_READ_DISK_MAGIC (0xbadb0c5U)
-#define ARCHIVE_MATCHING_MAGIC (0xcad11c9U)
+#define ARCHIVE_MATCH_MAGIC (0xcad11c9U)
#define ARCHIVE_STATE_NEW 1U
#define ARCHIVE_STATE_HEADER 2U
View
6 libarchive/archive_read_disk_posix.c
@@ -930,7 +930,7 @@ _archive_read_next_header2(struct archive *_a, struct archive_entry *entry)
* Perform path matching.
*/
if (a->matching) {
- r = archive_matching_path_excluded(a->matching, entry);
+ r = archive_match_path_excluded(a->matching, entry);
if (r < 0) {
archive_set_error(&(a->archive), errno,
"Faild : %s", archive_error_string(a->matching));
@@ -1043,7 +1043,7 @@ _archive_read_next_header2(struct archive *_a, struct archive_entry *entry)
* Perform time matching.
*/
if (a->matching) {
- r = archive_matching_time_excluded(a->matching, entry);
+ r = archive_match_time_excluded(a->matching, entry);
if (r < 0) {
archive_set_error(&(a->archive), errno,
"Faild : %s", archive_error_string(a->matching));
@@ -1070,7 +1070,7 @@ _archive_read_next_header2(struct archive *_a, struct archive_entry *entry)
* Perform owner matching.
*/
if (a->matching) {
- r = archive_matching_owner_excluded(a->matching, entry);
+ r = archive_match_owner_excluded(a->matching, entry);
if (r < 0) {
archive_set_error(&(a->archive), errno,
"Faild : %s", archive_error_string(a->matching));
View
6 libarchive/archive_read_disk_private.h
@@ -79,10 +79,10 @@ struct archive_read_disk {
struct archive_entry *);
void *metadata_filter_data;
- /* ARCHIVE_MATCHING object. */
+ /* ARCHIVE_MATCH object. */
struct archive *matching;
- /* Callback function, this will be invoked when ARCHIVE_MATCHING
- * archive_matching_*_excluded_ae return true. */
+ /* Callback function, this will be invoked when ARCHIVE_MATCH
+ * archive_match_*_excluded_ae return true. */
void (*excluded_cb_func)(struct archive *, void *,
struct archive_entry *);
void *excluded_cb_data;
View
6 libarchive/archive_read_disk_windows.c
@@ -809,7 +809,7 @@ _archive_read_next_header2(struct archive *_a, struct archive_entry *entry)
* Perform path matching.
*/
if (a->matching) {
- r = archive_matching_path_excluded(a->matching, entry);
+ r = archive_match_path_excluded(a->matching, entry);
if (r < 0) {
archive_set_error(&(a->archive), errno,
"Faild : %s", archive_error_string(a->matching));
@@ -884,7 +884,7 @@ _archive_read_next_header2(struct archive *_a, struct archive_entry *entry)
* Perform time matching.
*/
if (a->matching) {
- r = archive_matching_time_excluded(a->matching, entry);
+ r = archive_match_time_excluded(a->matching, entry);
if (r < 0) {
archive_set_error(&(a->archive), errno,
"Faild : %s", archive_error_string(a->matching));
@@ -911,7 +911,7 @@ _archive_read_next_header2(struct archive *_a, struct archive_entry *entry)
* Perform owner matching.
*/
if (a->matching) {
- r = archive_matching_owner_excluded(a->matching, entry);
+ r = archive_match_owner_excluded(a->matching, entry);
if (r < 0) {
archive_set_error(&(a->archive), errno,
"Faild : %s", archive_error_string(a->matching));
View
6 libarchive/test/CMakeLists.txt
@@ -16,9 +16,9 @@ IF(ENABLE_TEST)
test_archive_clear_error.c
test_archive_crypto.c
test_archive_getdate.c
- test_archive_matching_owner.c
- test_archive_matching_path.c
- test_archive_matching_time.c
+ test_archive_match_owner.c
+ test_archive_match_path.c
+ test_archive_match_time.c
test_archive_pathmatch.c
test_archive_read_close_twice.c
test_archive_read_close_twice_open_fd.c
View
182 ...rchive/test/test_archive_matching_owner.c → libarchive/test/test_archive_match_owner.c
@@ -32,40 +32,40 @@ test_uid(void)
struct archive_entry *ae;
struct archive *m;
- if (!assert((m = archive_matching_new()) != NULL))
+ if (!assert((m = archive_match_new()) != NULL))
return;
if (!assert((ae = archive_entry_new()) != NULL)) {
- archive_matching_free(m);
+ archive_match_free(m);
return;
}
- assertEqualIntA(m, 0, archive_matching_include_uid(m, 1000));
- assertEqualIntA(m, 0, archive_matching_include_uid(m, 1002));
+ assertEqualIntA(m, 0, archive_match_include_uid(m, 1000));
+ assertEqualIntA(m, 0, archive_match_include_uid(m, 1002));
archive_entry_set_uid(ae, 0);
failure("uid 0 should be excluded");
- assertEqualInt(1, archive_matching_owner_excluded(m, ae));
- assertEqualInt(1, archive_matching_excluded(m, ae));
+ assertEqualInt(1, archive_match_owner_excluded(m, ae));
+ assertEqualInt(1, archive_match_excluded(m, ae));
archive_entry_set_uid(ae, 1000);
failure("uid 1000 should not be excluded");
- assertEqualInt(0, archive_matching_owner_excluded(m, ae));
- assertEqualInt(0, archive_matching_excluded(m, ae));
+ assertEqualInt(0, archive_match_owner_excluded(m, ae));
+ assertEqualInt(0, archive_match_excluded(m, ae));
archive_entry_set_uid(ae, 1001);
failure("uid 1001 should be excluded");
- assertEqualInt(1, archive_matching_owner_excluded(m, ae));
- assertEqualInt(1, archive_matching_excluded(m, ae));
+ assertEqualInt(1, archive_match_owner_excluded(m, ae));
+ assertEqualInt(1, archive_match_excluded(m, ae));
archive_entry_set_uid(ae, 1002);
failure("uid 1002 should not be excluded");
- assertEqualInt(0, archive_matching_owner_excluded(m, ae));
- assertEqualInt(0, archive_matching_excluded(m, ae));
+ assertEqualInt(0, archive_match_owner_excluded(m, ae));
+ assertEqualInt(0, archive_match_excluded(m, ae));
archive_entry_set_uid(ae, 1003);
failure("uid 1003 should be excluded");
- assertEqualInt(1, archive_matching_owner_excluded(m, ae));
- assertEqualInt(1, archive_matching_excluded(m, ae));
+ assertEqualInt(1, archive_match_owner_excluded(m, ae));
+ assertEqualInt(1, archive_match_excluded(m, ae));
/* Clean up. */
archive_entry_free(ae);
- archive_matching_free(m);
+ archive_match_free(m);
}
static void
@@ -74,40 +74,40 @@ test_gid(void)
struct archive_entry *ae;
struct archive *m;
- if (!assert((m = archive_matching_new()) != NULL))
+ if (!assert((m = archive_match_new()) != NULL))
return;
if (!assert((ae = archive_entry_new()) != NULL)) {
- archive_matching_free(m);
+ archive_match_free(m);
return;
}
- assertEqualIntA(m, 0, archive_matching_include_gid(m, 1000));
- assertEqualIntA(m, 0, archive_matching_include_gid(m, 1002));
+ assertEqualIntA(m, 0, archive_match_include_gid(m, 1000));
+ assertEqualIntA(m, 0, archive_match_include_gid(m, 1002));
archive_entry_set_gid(ae, 0);
failure("uid 0 should be excluded");
- assertEqualInt(1, archive_matching_owner_excluded(m, ae));
- assertEqualInt(1, archive_matching_excluded(m, ae));
+ assertEqualInt(1, archive_match_owner_excluded(m, ae));
+ assertEqualInt(1, archive_match_excluded(m, ae));
archive_entry_set_gid(ae, 1000);
failure("uid 1000 should not be excluded");
- assertEqualInt(0, archive_matching_owner_excluded(m, ae));
- assertEqualInt(0, archive_matching_excluded(m, ae));
+ assertEqualInt(0, archive_match_owner_excluded(m, ae));
+ assertEqualInt(0, archive_match_excluded(m, ae));
archive_entry_set_gid(ae, 1001);
failure("uid 1001 should be excluded");
- assertEqualInt(1, archive_matching_owner_excluded(m, ae));
- assertEqualInt(1, archive_matching_excluded(m, ae));
+ assertEqualInt(1, archive_match_owner_excluded(m, ae));
+ assertEqualInt(1, archive_match_excluded(m, ae));
archive_entry_set_gid(ae, 1002);
failure("uid 1002 should not be excluded");
- assertEqualInt(0, archive_matching_owner_excluded(m, ae));
- assertEqualInt(0, archive_matching_excluded(m, ae));
+ assertEqualInt(0, archive_match_owner_excluded(m, ae));
+ assertEqualInt(0, archive_match_excluded(m, ae));
archive_entry_set_gid(ae, 1003);
failure("uid 1003 should be excluded");
- assertEqualInt(1, archive_matching_owner_excluded(m, ae));
- assertEqualInt(1, archive_matching_excluded(m, ae));
+ assertEqualInt(1, archive_match_owner_excluded(m, ae));
+ assertEqualInt(1, archive_match_excluded(m, ae));
/* Clean up. */
archive_entry_free(ae);
- archive_matching_free(m);
+ archive_match_free(m);
}
static void
@@ -116,40 +116,40 @@ test_uname_mbs(void)
struct archive_entry *ae;
struct archive *m;
- if (!assert((m = archive_matching_new()) != NULL))
+ if (!assert((m = archive_match_new()) != NULL))
return;
if (!assert((ae = archive_entry_new()) != NULL)) {
- archive_matching_free(m);
+ archive_match_free(m);
return;
}
- assertEqualIntA(m, 0, archive_matching_include_uname(m, "foo"));
- assertEqualIntA(m, 0, archive_matching_include_uname(m, "bar"));
+ assertEqualIntA(m, 0, archive_match_include_uname(m, "foo"));
+ assertEqualIntA(m, 0, archive_match_include_uname(m, "bar"));
archive_entry_copy_uname(ae, "unknown");
failure("User 'unknown' should be excluded");
- assertEqualInt(1, archive_matching_owner_excluded(m, ae));
- assertEqualInt(1, archive_matching_excluded(m, ae));
+ assertEqualInt(1, archive_match_owner_excluded(m, ae));
+ assertEqualInt(1, archive_match_excluded(m, ae));
archive_entry_copy_uname(ae, "foo");
failure("User 'foo' should not be excluded");
- assertEqualInt(0, archive_matching_owner_excluded(m, ae));
- assertEqualInt(0, archive_matching_excluded(m, ae));
+ assertEqualInt(0, archive_match_owner_excluded(m, ae));
+ assertEqualInt(0, archive_match_excluded(m, ae));
archive_entry_copy_uname(ae, "foo1");
failure("User 'foo1' should be excluded");
- assertEqualInt(1, archive_matching_owner_excluded(m, ae));
- assertEqualInt(1, archive_matching_excluded(m, ae));
+ assertEqualInt(1, archive_match_owner_excluded(m, ae));
+ assertEqualInt(1, archive_match_excluded(m, ae));
archive_entry_copy_uname(ae, "bar");
failure("User 'bar' should not be excluded");
- assertEqualInt(0, archive_matching_owner_excluded(m, ae));
- assertEqualInt(0, archive_matching_excluded(m, ae));
+ assertEqualInt(0, archive_match_owner_excluded(m, ae));
+ assertEqualInt(0, archive_match_excluded(m, ae));
archive_entry_copy_uname(ae, "bar1");
failure("User 'bar1' should be excluded");
- assertEqualInt(1, archive_matching_owner_excluded(m, ae));
- assertEqualInt(1, archive_matching_excluded(m, ae));
+ assertEqualInt(1, archive_match_owner_excluded(m, ae));
+ assertEqualInt(1, archive_match_excluded(m, ae));
/* Clean up. */
archive_entry_free(ae);
- archive_matching_free(m);
+ archive_match_free(m);
}
static void
@@ -158,40 +158,40 @@ test_uname_wcs(void)
struct archive_entry *ae;
struct archive *m;
- if (!assert((m = archive_matching_new()) != NULL))
+ if (!assert((m = archive_match_new()) != NULL))
return;
if (!assert((ae = archive_entry_new()) != NULL)) {
- archive_matching_free(m);
+ archive_match_free(m);
return;
}
- assertEqualIntA(m, 0, archive_matching_include_uname_w(m, L"foo"));
- assertEqualIntA(m, 0, archive_matching_include_uname_w(m, L"bar"));
+ assertEqualIntA(m, 0, archive_match_include_uname_w(m, L"foo"));
+ assertEqualIntA(m, 0, archive_match_include_uname_w(m, L"bar"));
archive_entry_copy_uname_w(ae, L"unknown");
failure("User 'unknown' should be excluded");
- assertEqualInt(1, archive_matching_owner_excluded(m, ae));
- assertEqualInt(1, archive_matching_excluded(m, ae));
+ assertEqualInt(1, archive_match_owner_excluded(m, ae));
+ assertEqualInt(1, archive_match_excluded(m, ae));
archive_entry_copy_uname_w(ae, L"foo");
failure("User 'foo' should not be excluded");
- assertEqualInt(0, archive_matching_owner_excluded(m, ae));
- assertEqualInt(0, archive_matching_excluded(m, ae));
+ assertEqualInt(0, archive_match_owner_excluded(m, ae));
+ assertEqualInt(0, archive_match_excluded(m, ae));
archive_entry_copy_uname_w(ae, L"foo1");
failure("User 'foo1' should be excluded");
- assertEqualInt(1, archive_matching_owner_excluded(m, ae));
- assertEqualInt(1, archive_matching_excluded(m, ae));
+ assertEqualInt(1, archive_match_owner_excluded(m, ae));
+ assertEqualInt(1, archive_match_excluded(m, ae));
archive_entry_copy_uname_w(ae, L"bar");
failure("User 'bar' should not be excluded");
- assertEqualInt(0, archive_matching_owner_excluded(m, ae));
- assertEqualInt(0, archive_matching_excluded(m, ae));
+ assertEqualInt(0, archive_match_owner_excluded(m, ae));
+ assertEqualInt(0, archive_match_excluded(m, ae));
archive_entry_copy_uname_w(ae, L"bar1");
failure("User 'bar1' should be excluded");
- assertEqualInt(1, archive_matching_owner_excluded(m, ae));
- assertEqualInt(1, archive_matching_excluded(m, ae));
+ assertEqualInt(1, archive_match_owner_excluded(m, ae));
+ assertEqualInt(1, archive_match_excluded(m, ae));
/* Clean up. */
archive_entry_free(ae);
- archive_matching_free(m);
+ archive_match_free(m);
}
static void
@@ -200,40 +200,40 @@ test_gname_mbs(void)
struct archive_entry *ae;
struct archive *m;
- if (!assert((m = archive_matching_new()) != NULL))
+ if (!assert((m = archive_match_new()) != NULL))
return;
if (!assert((ae = archive_entry_new()) != NULL)) {
- archive_matching_free(m);
+ archive_match_free(m);
return;
}
- assertEqualIntA(m, 0, archive_matching_include_gname(m, "foo"));
- assertEqualIntA(m, 0, archive_matching_include_gname(m, "bar"));
+ assertEqualIntA(m, 0, archive_match_include_gname(m, "foo"));
+ assertEqualIntA(m, 0, archive_match_include_gname(m, "bar"));
archive_entry_copy_gname(ae, "unknown");
failure("Group 'unknown' should be excluded");
- assertEqualInt(1, archive_matching_owner_excluded(m, ae));
- assertEqualInt(1, archive_matching_excluded(m, ae));
+ assertEqualInt(1, archive_match_owner_excluded(m, ae));
+ assertEqualInt(1, archive_match_excluded(m, ae));
archive_entry_copy_gname(ae, "foo");
failure("Group 'foo' should not be excluded");
- assertEqualInt(0, archive_matching_owner_excluded(m, ae));
- assertEqualInt(0, archive_matching_excluded(m, ae));
+ assertEqualInt(0, archive_match_owner_excluded(m, ae));
+ assertEqualInt(0, archive_match_excluded(m, ae));
archive_entry_copy_gname(ae, "foo1");
failure("Group 'foo1' should be excluded");
- assertEqualInt(1, archive_matching_owner_excluded(m, ae));
- assertEqualInt(1, archive_matching_excluded(m, ae));
+ assertEqualInt(1, archive_match_owner_excluded(m, ae));
+ assertEqualInt(1, archive_match_excluded(m, ae));
archive_entry_copy_gname(ae, "bar");
failure("Group 'bar' should not be excluded");
- assertEqualInt(0, archive_matching_owner_excluded(m, ae));
- assertEqualInt(0, archive_matching_excluded(m, ae));
+ assertEqualInt(0, archive_match_owner_excluded(m, ae));
+ assertEqualInt(0, archive_match_excluded(m, ae));
archive_entry_copy_gname(ae, "bar1");
failure("Group 'bar1' should be excluded");
- assertEqualInt(1, archive_matching_owner_excluded(m, ae));
- assertEqualInt(1, archive_matching_excluded(m, ae));
+ assertEqualInt(1, archive_match_owner_excluded(m, ae));
+ assertEqualInt(1, archive_match_excluded(m, ae));
/* Clean up. */
archive_entry_free(ae);
- archive_matching_free(m);
+ archive_match_free(m);
}
static void
@@ -242,43 +242,43 @@ test_gname_wcs(void)
struct archive_entry *ae;
struct archive *m;
- if (!assert((m = archive_matching_new()) != NULL))
+ if (!assert((m = archive_match_new()) != NULL))
return;
if (!assert((ae = archive_entry_new()) != NULL)) {
- archive_matching_free(m);
+ archive_match_free(m);
return;
}
- assertEqualIntA(m, 0, archive_matching_include_gname_w(m, L"foo"));
- assertEqualIntA(m, 0, archive_matching_include_gname_w(m, L"bar"));
+ assertEqualIntA(m, 0, archive_match_include_gname_w(m, L"foo"));
+ assertEqualIntA(m, 0, archive_match_include_gname_w(m, L"bar"));
archive_entry_copy_gname_w(ae, L"unknown");
failure("Group 'unknown' should be excluded");
- assertEqualInt(1, archive_matching_owner_excluded(m, ae));
- assertEqualInt(1, archive_matching_excluded(m, ae));
+ assertEqualInt(1, archive_match_owner_excluded(m, ae));
+ assertEqualInt(1, archive_match_excluded(m, ae));
archive_entry_copy_gname_w(ae, L"foo");
failure("Group 'foo' should not be excluded");
- assertEqualInt(0, archive_matching_owner_excluded(m, ae));
- assertEqualInt(0, archive_matching_excluded(m, ae));
+ assertEqualInt(0, archive_match_owner_excluded(m, ae));
+ assertEqualInt(0, archive_match_excluded(m, ae));
archive_entry_copy_gname_w(ae, L"foo1");
failure("Group 'foo1' should be excluded");
- assertEqualInt(1, archive_matching_owner_excluded(m, ae));
- assertEqualInt(1, archive_matching_excluded(m, ae));
+ assertEqualInt(1, archive_match_owner_excluded(m, ae));
+ assertEqualInt(1, archive_match_excluded(m, ae));
archive_entry_copy_gname_w(ae, L"bar");
failure("Group 'bar' should not be excluded");
- assertEqualInt(0, archive_matching_owner_excluded(m, ae));
- assertEqualInt(0, archive_matching_excluded(m, ae));
+ assertEqualInt(0, archive_match_owner_excluded(m, ae));
+ assertEqualInt(0, archive_match_excluded(m, ae));
archive_entry_copy_gname_w(ae, L"bar1");
failure("Group 'bar1' should be excluded");
- assertEqualInt(1, archive_matching_owner_excluded(m, ae));
- assertEqualInt(1, archive_matching_excluded(m, ae));
+ assertEqualInt(1, archive_match_owner_excluded(m, ae));
+ assertEqualInt(1, archive_match_excluded(m, ae));
/* Clean up. */
archive_entry_free(ae);
- archive_matching_free(m);
+ archive_match_free(m);
}
-DEFINE_TEST(test_archive_matching_owner)
+DEFINE_TEST(test_archive_match_owner)
{
test_uid();
test_gid();
View
144 libarchive/test/test_archive_matching_path.c → libarchive/test/test_archive_match_path.c
@@ -32,41 +32,41 @@ test_exclusion_mbs(void)
struct archive_entry *ae;
struct archive *m;
- if (!assert((m = archive_matching_new()) != NULL))
+ if (!assert((m = archive_match_new()) != NULL))
return;
if (!assert((ae = archive_entry_new()) != NULL)) {
- archive_matching_free(m);
+ archive_match_free(m);
return;
}
/* Test for pattern "^aa*" */
- assertEqualIntA(m, 0, archive_matching_exclude_pattern(m, "^aa*"));
+ assertEqualIntA(m, 0, archive_match_exclude_pattern(m, "^aa*"));
/* Test with 'aa1234', which should be excluded. */
archive_entry_copy_pathname(ae, "aa1234");
failure("'aa1234' should be excluded");
- assertEqualInt(1, archive_matching_path_excluded(m, ae));
- assertEqualInt(1, archive_matching_excluded(m, ae));
+ assertEqualInt(1, archive_match_path_excluded(m, ae));
+ assertEqualInt(1, archive_match_excluded(m, ae));
archive_entry_clear(ae);
archive_entry_copy_pathname_w(ae, L"aa1234");
failure("'aa1234' should be excluded");
- assertEqualInt(1, archive_matching_path_excluded(m, ae));
- assertEqualInt(1, archive_matching_excluded(m, ae));
+ assertEqualInt(1, archive_match_path_excluded(m, ae));
+ assertEqualInt(1, archive_match_excluded(m, ae));
/* Test with 'a1234', which should not be excluded. */
archive_entry_copy_pathname(ae, "a1234");
failure("'a1234' should not be excluded");
- assertEqualInt(0, archive_matching_path_excluded(m, ae));
- assertEqualInt(0, archive_matching_excluded(m, ae));
+ assertEqualInt(0, archive_match_path_excluded(m, ae));
+ assertEqualInt(0, archive_match_excluded(m, ae));
archive_entry_clear(ae);
archive_entry_copy_pathname_w(ae, L"a1234");
failure("'a1234' should not be excluded");
- assertEqualInt(0, archive_matching_path_excluded(m, ae));
- assertEqualInt(0, archive_matching_excluded(m, ae));
+ assertEqualInt(0, archive_match_path_excluded(m, ae));
+ assertEqualInt(0, archive_match_excluded(m, ae));
/* Clean up. */
archive_entry_free(ae);
- archive_matching_free(m);
+ archive_match_free(m);
}
static void
@@ -75,41 +75,41 @@ test_exclusion_wcs(void)
struct archive_entry *ae;
struct archive *m;
- if (!assert((m = archive_matching_new()) != NULL))
+ if (!assert((m = archive_match_new()) != NULL))
return;
if (!assert((ae = archive_entry_new()) != NULL)) {
- archive_matching_free(m);
+ archive_match_free(m);
return;
}
/* Test for pattern "^aa*" */
- assertEqualIntA(m, 0, archive_matching_exclude_pattern_w(m, L"^aa*"));
+ assertEqualIntA(m, 0, archive_match_exclude_pattern_w(m, L"^aa*"));
/* Test with 'aa1234', which should be excluded. */
archive_entry_copy_pathname(ae, "aa1234");
failure("'aa1234' should be excluded");
- assertEqualInt(1, archive_matching_path_excluded(m, ae));
- assertEqualInt(1, archive_matching_excluded(m, ae));
+ assertEqualInt(1, archive_match_path_excluded(m, ae));
+ assertEqualInt(1, archive_match_excluded(m, ae));
archive_entry_clear(ae);
archive_entry_copy_pathname_w(ae, L"aa1234");
failure("'aa1234' should be excluded");
- assertEqualInt(1, archive_matching_path_excluded(m, ae));
- assertEqualInt(1, archive_matching_excluded(m, ae));
+ assertEqualInt(1, archive_match_path_excluded(m, ae));
+ assertEqualInt(1, archive_match_excluded(m, ae));
/* Test with 'a1234', which should not be excluded. */
archive_entry_copy_pathname(ae, "a1234");
failure("'a1234' should not be excluded");
- assertEqualInt(0, archive_matching_path_excluded(m, ae));
- assertEqualInt(0, archive_matching_excluded(m, ae));
+ assertEqualInt(0, archive_match_path_excluded(m, ae));
+ assertEqualInt(0, archive_match_excluded(m, ae));
archive_entry_clear(ae);
archive_entry_copy_pathname_w(ae, L"a1234");
failure("'a1234' should not be excluded");
- assertEqualInt(0, archive_matching_path_excluded(m, ae));
- assertEqualInt(0, archive_matching_excluded(m, ae));
+ assertEqualInt(0, archive_match_path_excluded(m, ae));
+ assertEqualInt(0, archive_match_excluded(m, ae));
/* Clean up. */
archive_entry_free(ae);
- archive_matching_free(m);
+ archive_match_free(m);
}
static void
@@ -119,46 +119,46 @@ test_inclusion_mbs(void)
struct archive *m;
const char *mp;
- if (!assert((m = archive_matching_new()) != NULL))
+ if (!assert((m = archive_match_new()) != NULL))
return;
if (!assert((ae = archive_entry_new()) != NULL)) {
- archive_matching_free(m);
+ archive_match_free(m);
return;
}
/* Test for pattern "^aa*" */
- assertEqualIntA(m, 0, archive_matching_include_pattern(m, "^aa*"));
+ assertEqualIntA(m, 0, archive_match_include_pattern(m, "^aa*"));
/* Test with 'aa1234', which should not be excluded. */
archive_entry_copy_pathname(ae, "aa1234");
failure("'aa1234' should not be excluded");
- assertEqualInt(0, archive_matching_path_excluded(m, ae));
- assertEqualInt(0, archive_matching_excluded(m, ae));
+ assertEqualInt(0, archive_match_path_excluded(m, ae));
+ assertEqualInt(0, archive_match_excluded(m, ae));
archive_entry_clear(ae);
archive_entry_copy_pathname_w(ae, L"aa1234");
failure("'aa1234' should not be excluded");
- assertEqualInt(0, archive_matching_path_excluded(m, ae));
- assertEqualInt(0, archive_matching_excluded(m, ae));
+ assertEqualInt(0, archive_match_path_excluded(m, ae));
+ assertEqualInt(0, archive_match_excluded(m, ae));
/* Test with 'a1234', which should be excluded. */
archive_entry_copy_pathname(ae, "a1234");
failure("'a1234' should be excluded");
- assertEqualInt(1, archive_matching_path_excluded(m, ae));
- assertEqualInt(1, archive_matching_excluded(m, ae));
+ assertEqualInt(1, archive_match_path_excluded(m, ae));
+ assertEqualInt(1, archive_match_excluded(m, ae));
archive_entry_clear(ae);
archive_entry_copy_pathname_w(ae, L"a1234");
failure("'a1234' should be excluded");
- assertEqualInt(1, archive_matching_path_excluded(m, ae));
- assertEqualInt(1, archive_matching_excluded(m, ae));
+ assertEqualInt(1, archive_match_path_excluded(m, ae));
+ assertEqualInt(1, archive_match_excluded(m, ae));
/* Verify unmatched_inclusions. */
- assertEqualInt(0, archive_matching_path_unmatched_inclusions(m));
+ assertEqualInt(0, archive_match_path_unmatched_inclusions(m));
assertEqualIntA(m, ARCHIVE_EOF,
- archive_matching_path_unmatched_inclusions_next(m, &mp));
+ archive_match_path_unmatched_inclusions_next(m, &mp));
/* Clean up. */
archive_entry_free(ae);
- archive_matching_free(m);
+ archive_match_free(m);
}
static void
@@ -168,46 +168,46 @@ test_inclusion_wcs(void)
struct archive *m;
const char *mp;
- if (!assert((m = archive_matching_new()) != NULL))
+ if (!assert((m = archive_match_new()) != NULL))
return;
if (!assert((ae = archive_entry_new()) != NULL)) {
- archive_matching_free(m);
+ archive_match_free(m);
return;
}
/* Test for pattern "^aa*" */
- assertEqualIntA(m, 0, archive_matching_include_pattern_w(m, L"^aa*"));
+ assertEqualIntA(m, 0, archive_match_include_pattern_w(m, L"^aa*"));
/* Test with 'aa1234', which should not be excluded. */
archive_entry_copy_pathname(ae, "aa1234");
failure("'aa1234' should not be excluded");
- assertEqualInt(0, archive_matching_path_excluded(m, ae));
- assertEqualInt(0, archive_matching_excluded(m, ae));
+ assertEqualInt(0, archive_match_path_excluded(m, ae));
+ assertEqualInt(0, archive_match_excluded(m, ae));
archive_entry_clear(ae);
archive_entry_copy_pathname_w(ae, L"aa1234");
failure("'aa1234' should not be excluded");
- assertEqualInt(0, archive_matching_path_excluded(m, ae));
- assertEqualInt(0, archive_matching_excluded(m, ae));
+ assertEqualInt(0, archive_match_path_excluded(m, ae));
+ assertEqualInt(0, archive_match_excluded(m, ae));
/* Test with 'a1234', which should be excluded. */
archive_entry_copy_pathname(ae, "a1234");
failure("'a1234' should be excluded");
- assertEqualInt(1, archive_matching_path_excluded(m, ae));
- assertEqualInt(1, archive_matching_excluded(m, ae));
+ assertEqualInt(1, archive_match_path_excluded(m, ae));
+ assertEqualInt(1, archive_match_excluded(m, ae));
archive_entry_clear(ae);
archive_entry_copy_pathname_w(ae, L"a1234");
failure("'a1234' should be excluded");
- assertEqualInt(1, archive_matching_path_excluded(m, ae));
- assertEqualInt(1, archive_matching_excluded(m, ae));
+ assertEqualInt(1, archive_match_path_excluded(m, ae));
+ assertEqualInt(1, archive_match_excluded(m, ae));
/* Verify unmatched_inclusions. */
- assertEqualInt(0, archive_matching_path_unmatched_inclusions(m));
+ assertEqualInt(0, archive_match_path_unmatched_inclusions(m));
assertEqualIntA(m, ARCHIVE_EOF,
- archive_matching_path_unmatched_inclusions_next(m, &mp));
+ archive_match_path_unmatched_inclusions_next(m, &mp));
/* Clean up. */
archive_entry_free(ae);
- archive_matching_free(m);
+ archive_match_free(m);
}
static void
@@ -218,60 +218,60 @@ test_exclusion_and_inclusion(void)
const char *mp;
const wchar_t *wp;
- if (!assert((m = archive_matching_new()) != NULL))
+ if (!assert((m = archive_match_new()) != NULL))
return;
if (!assert((ae = archive_entry_new()) != NULL)) {
- archive_matching_free(m);
+ archive_match_free(m);
return;
}
- assertEqualIntA(m, 0, archive_matching_exclude_pattern(m, "^aaa*"));
- assertEqualIntA(m, 0, archive_matching_include_pattern_w(m, L"^aa*"));
- assertEqualIntA(m, 0, archive_matching_include_pattern(m, "^a1*"));
+ assertEqualIntA(m, 0, archive_match_exclude_pattern(m, "^aaa*"));
+ assertEqualIntA(m, 0, archive_match_include_pattern_w(m, L"^aa*"));
+ assertEqualIntA(m, 0, archive_match_include_pattern(m, "^a1*"));
/* Test with 'aa1234', which should not be excluded. */
archive_entry_copy_pathname(ae, "aa1234");
failure("'aa1234' should not be excluded");
- assertEqualInt(0, archive_matching_path_excluded(m, ae));
- assertEqualInt(0, archive_matching_excluded(m, ae));
+ assertEqualInt(0, archive_match_path_excluded(m, ae));
+ assertEqualInt(0, archive_match_excluded(m, ae));
archive_entry_clear(ae);
archive_entry_copy_pathname_w(ae, L"aa1234");
failure("'aa1234' should not be excluded");
- assertEqualInt(0, archive_matching_path_excluded(m, ae));
- assertEqualInt(0, archive_matching_excluded(m, ae));
+ assertEqualInt(0, archive_match_path_excluded(m, ae));
+ assertEqualInt(0, archive_match_excluded(m, ae));
/* Test with 'aaa1234', which should be excluded. */
archive_entry_copy_pathname(ae, "aaa1234");
failure("'aaa1234' should be excluded");
- assertEqualInt(1, archive_matching_path_excluded(m, ae));
- assertEqualInt(1, archive_matching_excluded(m, ae));
+ assertEqualInt(1, archive_match_path_excluded(m, ae));
+ assertEqualInt(1, archive_match_excluded(m, ae));
archive_entry_clear(ae);
archive_entry_copy_pathname_w(ae, L"aaa1234");
failure("'aaa1234' should be excluded");
- assertEqualInt(1, archive_matching_path_excluded(m, ae));
- assertEqualInt(1, archive_matching_excluded(m, ae));
+ assertEqualInt(1, archive_match_path_excluded(m, ae));
+ assertEqualInt(1, archive_match_excluded(m, ae));
/* Verify unmatched_inclusions. */
- assertEqualInt(1, archive_matching_path_unmatched_inclusions(m));
+ assertEqualInt(1, archive_match_path_unmatched_inclusions(m));
/* Verify unmatched inclusion patterns. */
assertEqualIntA(m, ARCHIVE_OK,
- archive_matching_path_unmatched_inclusions_next(m, &mp));
+ archive_match_path_unmatched_inclusions_next(m, &mp));
assertEqualString("^a1*", mp);
assertEqualIntA(m, ARCHIVE_EOF,
- archive_matching_path_unmatched_inclusions_next(m, &mp));
+ archive_match_path_unmatched_inclusions_next(m, &mp));
/* Verify unmatched inclusion patterns again in Wide-Char. */
assertEqualIntA(m, ARCHIVE_OK,
- archive_matching_path_unmatched_inclusions_next_w(m, &wp));
+ archive_match_path_unmatched_inclusions_next_w(m, &wp));
assertEqualWString(L"^a1*", wp);
assertEqualIntA(m, ARCHIVE_EOF,
- archive_matching_path_unmatched_inclusions_next_w(m, &wp));
+ archive_match_path_unmatched_inclusions_next_w(m, &wp));
/* Clean up. */
archive_entry_free(ae);
- archive_matching_free(m);
+ archive_match_free(m);
}
-DEFINE_TEST(test_archive_matching_path)
+DEFINE_TEST(test_archive_match_path)
{
test_exclusion_mbs();
test_exclusion_wcs();
View
642 libarchive/test/test_archive_matching_time.c → libarchive/test/test_archive_match_time.c
@@ -34,50 +34,50 @@ test_newer_time(void)
struct archive_entry *ae;
struct archive *m;
- if (!assert((m = archive_matching_new()) != NULL))
+ if (!assert((m = archive_match_new()) != NULL))
return;
if (!assert((ae = archive_entry_new()) != NULL)) {
- archive_matching_free(m);
+ archive_match_free(m);
return;
}
- assertEqualIntA(m, 0, archive_matching_include_time(m,
- ARCHIVE_MATCHING_MTIME | ARCHIVE_MATCHING_CTIME |
- ARCHIVE_MATCHING_NEWER, 7880, 0));
+ assertEqualIntA(m, 0, archive_match_include_time(m,
+ ARCHIVE_MATCH_MTIME | ARCHIVE_MATCH_CTIME |
+ ARCHIVE_MATCH_NEWER, 7880, 0));
archive_entry_copy_pathname(ae, "file1");
archive_entry_set_mtime(ae, 7880, 0);
archive_entry_set_ctime(ae, 7880, 0);
failure("Both Its mtime and ctime should be excluded");
- assertEqualInt(1, archive_matching_time_excluded(m, ae));
- assertEqualInt(1, archive_matching_excluded(m, ae));
+ assertEqualInt(1, archive_match_time_excluded(m, ae));
+ assertEqualInt(1, archive_match_excluded(m, ae));
archive_entry_set_mtime(ae, 7879, 999);
archive_entry_set_ctime(ae, 7879, 999);
failure("Both Its mtime and ctime should be excluded");
- assertEqualInt(1, archive_matching_time_excluded(m, ae));
- assertEqualInt(1, archive_matching_excluded(m, ae));
+ assertEqualInt(1, archive_match_time_excluded(m, ae));
+ assertEqualInt(1, archive_match_excluded(m, ae));
archive_entry_set_mtime(ae, 7881, 0);
archive_entry_set_ctime(ae, 7881, 0);
failure("Both Its mtime and ctime should not be excluded");
- assertEqualInt(0, archive_matching_time_excluded(m, ae));
- assertEqualInt(0, archive_matching_excluded(m, ae));
+ assertEqualInt(0, archive_match_time_excluded(m, ae));
+ assertEqualInt(0, archive_match_excluded(m, ae));
archive_entry_set_mtime(ae, 7880, 1);
archive_entry_set_ctime(ae, 7880, 0);
failure("Its mtime should be excluded");
- assertEqualInt(1, archive_matching_time_excluded(m, ae));
- assertEqualInt(1, archive_matching_excluded(m, ae));
+ assertEqualInt(1, archive_match_time_excluded(m, ae));
+ assertEqualInt(1, archive_match_excluded(m, ae));