From 7e00ba0b315e0f5beacb916637f3c51b8d69cb8f Mon Sep 17 00:00:00 2001 From: Sascha Kruse Date: Tue, 22 Feb 2011 08:30:12 +0100 Subject: [PATCH] Match wildcards in IgnorePkg, IgnoreGroup Signed-off-by: Sascha Kruse --- lib/libalpm/package.c | 15 +++++++++++++-- 1 files changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c index 0a1102c..56a835b 100644 --- a/lib/libalpm/package.c +++ b/lib/libalpm/package.c @@ -30,6 +30,7 @@ #include #include #include +#include /* libalpm */ #include "package.h" @@ -559,6 +560,16 @@ pmpkg_t *_alpm_pkg_find(alpm_list_t *haystack, const char *needle) return(NULL); } +static int _fnmatch(const char *pattern, const char *string) +{ + return fnmatch(pattern, string, 0); +} + +static int _fnmatch_swapped(const char *string, const char *pattern) +{ + return fnmatch(pattern, string, 0); +} + /** Test if a package should be ignored. * * Checks if the package is ignored via IgnorePkg, or if the package is @@ -573,14 +584,14 @@ int _alpm_pkg_should_ignore(pmpkg_t *pkg) alpm_list_t *groups = NULL; /* first see if the package is ignored */ - if(alpm_list_find_str(handle->ignorepkg, alpm_pkg_get_name(pkg))) { + if(alpm_list_find(handle->ignorepkg, alpm_pkg_get_name(pkg), (alpm_list_fn_cmp) _fnmatch)) { return(1); } /* next see if the package is in a group that is ignored */ for(groups = handle->ignoregrp; groups; groups = alpm_list_next(groups)) { char *grp = (char *)alpm_list_getdata(groups); - if(alpm_list_find_str(alpm_pkg_get_groups(pkg), grp)) { + if(alpm_list_find(alpm_pkg_get_groups(pkg), grp, (alpm_list_fn_cmp) _fnmatch_swapped)) { return(1); } } -- 1.7.4.1