From 67f5a753e50da8737dc28b0ea2c2194b21d76fdd Mon Sep 17 00:00:00 2001 From: Timo Teräs Date: Sat, 4 Mar 2023 13:54:54 +0200 Subject: db, apps: sort display results based on package names --- src/app_policy.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/app_policy.c') diff --git a/src/app_policy.c b/src/app_policy.c index 954eb9d..519257a 100644 --- a/src/app_policy.c +++ b/src/app_policy.c @@ -15,13 +15,13 @@ extern const char * const apk_installed_file; -static void print_policy(struct apk_database *db, const char *match, struct apk_name *name, void *ctx) +static int print_policy(struct apk_database *db, const char *match, struct apk_name *name, void *ctx) { struct apk_provider *p; struct apk_repository *repo; int i, j, num = 0; - if (!name) return; + if (!name) return 0; /* zlib1g policy: @@ -58,11 +58,13 @@ zlib1g policy: } } } + return 0; } static int policy_main(void *ctx, struct apk_database *db, struct apk_string_array *args) { - apk_name_foreach_matching(db, args, apk_foreach_genid(), print_policy, NULL); + if (!args->num) return 0; + apk_db_foreach_sorted_name(db, args, print_policy, NULL); return 0; } -- cgit v1.2.3-60-g2f50