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-04-11 20:47:43 +0300 |
commit | 67f5a753e50da8737dc28b0ea2c2194b21d76fdd (patch) | |
tree | 657a81a529d2733eecae1837cc48ac25abe73357 /src/app_policy.c | |
parent | efb55ce650d3cac9a607560d840f95c1127e68f5 (diff) | |
download | apk-tools-67f5a753e50da8737dc28b0ea2c2194b21d76fdd.tar.gz apk-tools-67f5a753e50da8737dc28b0ea2c2194b21d76fdd.tar.bz2 apk-tools-67f5a753e50da8737dc28b0ea2c2194b21d76fdd.tar.xz apk-tools-67f5a753e50da8737dc28b0ea2c2194b21d76fdd.zip |
db, apps: sort display results based on package names
Diffstat (limited to 'src/app_policy.c')
-rw-r--r-- | src/app_policy.c | 8 |
1 files changed, 5 insertions, 3 deletions
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; } |