summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2009-04-03 12:15:18 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2009-04-03 12:16:12 +0000
commit6e1045696741385fa028f93eef181aa1f9cb33c1 (patch)
tree53adcf5d08864a306e3a95de2decf25e9ab8a635
parent8d44e8ed5c845700c1c19b88cac0bf1c8dee720c (diff)
downloadapk-tools-6e1045696741385fa028f93eef181aa1f9cb33c1.tar.gz
apk-tools-6e1045696741385fa028f93eef181aa1f9cb33c1.tar.bz2
apk-tools-6e1045696741385fa028f93eef181aa1f9cb33c1.tar.xz
apk-tools-6e1045696741385fa028f93eef181aa1f9cb33c1.zip
search: use fnmatch so we have support for wildcards
-rw-r--r--src/search.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/search.c b/src/search.c
index dbbc2f4..208cff1 100644
--- a/src/search.c
+++ b/src/search.c
@@ -9,6 +9,7 @@
* by the Free Software Foundation. See http://www.gnu.org/ for details.
*/
+#include <fnmatch.h>
#include <stdio.h>
#include "apk_defines.h"
#include "apk_applet.h"
@@ -46,7 +47,7 @@ static int search_query_print(apk_hash_item item, void *ctx)
struct search_query_ctx *ictx = (struct search_query_ctx *) ctx;
struct apk_package *pkg = (struct apk_package *) item;
- if( strstr(pkg->name->name, ictx->query) == NULL )
+ if (fnmatch(ictx->query, pkg->name->name, 0) != 0)
return 0;
search_list_print(item, ictx->db);