diff options
author | Timo Teräs <timo.teras@iki.fi> | 2023-03-04 13:54:54 +0200 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2023-03-06 21:39:48 +0200 |
commit | 65b46f7462e1acad19884da67a9a59996a642847 (patch) | |
tree | 1997054daa45211d97bc273f0a50ccdfe2084ff5 /src/app_search.c | |
parent | 5f84463a34bd8c63a3ff649ae550c68934adaa5b (diff) | |
download | apk-tools-65b46f7462e1acad19884da67a9a59996a642847.tar.gz apk-tools-65b46f7462e1acad19884da67a9a59996a642847.tar.bz2 apk-tools-65b46f7462e1acad19884da67a9a59996a642847.tar.xz apk-tools-65b46f7462e1acad19884da67a9a59996a642847.zip |
db, apps: sort display results based on package names
Diffstat (limited to 'src/app_search.c')
-rw-r--r-- | src/app_search.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/app_search.c b/src/app_search.c index 4ac4243..846aed0 100644 --- a/src/app_search.c +++ b/src/app_search.c @@ -144,13 +144,13 @@ match: ctx->print_result(ctx, pkg); } -static void print_result(struct apk_database *db, const char *match, struct apk_name *name, void *pctx) +static int print_result(struct apk_database *db, const char *match, struct apk_name *name, void *pctx) { struct search_ctx *ctx = pctx; struct apk_provider *p; struct apk_package *pkg = NULL; - if (!name) return; + if (!name) return 0; if (ctx->show_all) { foreach_array_item(p, name->providers) @@ -164,6 +164,7 @@ static void print_result(struct apk_database *db, const char *match, struct apk_ if (pkg) print_result_pkg(ctx, pkg); } + return 0; } static int print_pkg(apk_hash_item item, void *pctx) @@ -196,9 +197,7 @@ static int search_main(void *pctx, struct apk_ctx *ac, struct apk_string_array * *pmatch = tmp; } } - apk_name_foreach_matching( - db, args, APK_FOREACH_NULL_MATCHES_ALL | apk_foreach_genid(), - print_result, ctx); + apk_db_foreach_sorted_name(db, args, print_result, ctx); return 0; } |