diff options
author | Timo Teräs <timo.teras@iki.fi> | 2013-06-18 13:01:51 +0300 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2013-06-18 13:02:27 +0300 |
commit | fe41ae07b90bbd4609ee6871def851a41027aae8 (patch) | |
tree | 7f5a872c5ee030450e3cfdb84a73c9338f69d7f4 /src/cache.c | |
parent | c51d82f8f616c2c8939b74c1d78f723ef778f0c8 (diff) | |
download | apk-tools-fe41ae07b90bbd4609ee6871def851a41027aae8.tar.gz apk-tools-fe41ae07b90bbd4609ee6871def851a41027aae8.tar.bz2 apk-tools-fe41ae07b90bbd4609ee6871def851a41027aae8.tar.xz apk-tools-fe41ae07b90bbd4609ee6871def851a41027aae8.zip |
apk: use string array in applet mains, separate apk_name_foreach_matching
Diffstat (limited to 'src/cache.c')
-rw-r--r-- | src/cache.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/cache.c b/src/cache.c index babfaa6..84b2786 100644 --- a/src/cache.c +++ b/src/cache.c @@ -111,18 +111,20 @@ static int cache_clean(struct apk_database *db) return apk_db_cache_foreach_item(db, cache_clean_item); } -static int cache_main(void *ctx, struct apk_database *db, int argc, char **argv) +static int cache_main(void *ctx, struct apk_database *db, struct apk_string_array *args) { + char *arg; int r = 0, actions = 0; - if (argc != 1) + if (args->num != 1) return -EINVAL; - if (strcmp(argv[0], "sync") == 0) + arg = args->item[0]; + if (strcmp(arg, "sync") == 0) actions = CACHE_CLEAN | CACHE_DOWNLOAD; - else if (strcmp(argv[0], "clean") == 0) + else if (strcmp(arg, "clean") == 0) actions = CACHE_CLEAN; - else if (strcmp(argv[0], "download") == 0) + else if (strcmp(arg, "download") == 0) actions = CACHE_DOWNLOAD; else return -EINVAL; @@ -137,7 +139,6 @@ static int cache_main(void *ctx, struct apk_database *db, int argc, char **argv) r = cache_clean(db); if (r == 0 && (actions & CACHE_DOWNLOAD)) r = cache_download(db); - err: return r; } |