bin/xbps-query/ownedby.c: simply match patterns with fnmatch(3).

This commit is contained in:
Juan RP 2013-05-13 15:10:47 +02:00
parent cb15387bb8
commit 91c08bfe75

View File

@ -73,8 +73,7 @@ match_files_by_pattern(prop_dictionary_t pkg_filesd,
if (filestr == NULL) if (filestr == NULL)
continue; continue;
for (x = 0; x < ffd->npatterns; x++) { for (x = 0; x < ffd->npatterns; x++) {
if ((strcmp(filestr, ffd->patterns[x]) == 0) || if ((fnmatch(ffd->patterns[x], filestr, FNM_PERIOD)) == 0) {
(fnmatch(ffd->patterns[x], filestr, FNM_PERIOD)) == 0) {
printf("%s: %s (%s)\n", pkgver, printf("%s: %s (%s)\n", pkgver,
filestr, typestr); filestr, typestr);
} }
@ -136,8 +135,7 @@ repo_match_files_by_pattern(prop_dictionary_t pkgd,
for (i = 0; i < prop_array_count(array); i++) { for (i = 0; i < prop_array_count(array); i++) {
prop_array_get_cstring_nocopy(array, i, &filestr); prop_array_get_cstring_nocopy(array, i, &filestr);
for (x = 0; x < ffd->npatterns; x++) { for (x = 0; x < ffd->npatterns; x++) {
if ((strcmp(filestr, ffd->patterns[x]) == 0) || if ((fnmatch(ffd->patterns[x], filestr, FNM_PERIOD)) == 0) {
(fnmatch(ffd->patterns[x], filestr, FNM_PERIOD)) == 0) {
prop_dictionary_get_cstring_nocopy(pkgd, prop_dictionary_get_cstring_nocopy(pkgd,
"pkgver", &pkgver); "pkgver", &pkgver);
printf("%s: %s (%s)\n", printf("%s: %s (%s)\n",