summaryrefslogtreecommitdiff
path: root/src/verify.c
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2013-06-18 13:01:51 +0300
committerTimo Teräs <timo.teras@iki.fi>2013-06-18 13:02:27 +0300
commitfe41ae07b90bbd4609ee6871def851a41027aae8 (patch)
tree7f5a872c5ee030450e3cfdb84a73c9338f69d7f4 /src/verify.c
parentc51d82f8f616c2c8939b74c1d78f723ef778f0c8 (diff)
downloadapk-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/verify.c')
-rw-r--r--src/verify.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/verify.c b/src/verify.c
index cfb800a..ee3ecd6 100644
--- a/src/verify.c
+++ b/src/verify.c
@@ -17,21 +17,22 @@
#include "apk_database.h"
#include "apk_print.h"
-static int verify_main(void *ctx, struct apk_database *db, int argc, char **argv)
+static int verify_main(void *ctx, struct apk_database *db, struct apk_string_array *args)
{
struct apk_sign_ctx sctx;
struct apk_istream *is;
- int i, r, ok, rc = 0;
+ char **parg;
+ int r, ok, rc = 0;
- for (i = 0; i < argc; i++) {
+ foreach_array_item(parg, args) {
apk_sign_ctx_init(&sctx, APK_SIGN_VERIFY, NULL, db->keys_fd);
- is = apk_bstream_gunzip_mpart(apk_bstream_from_file(AT_FDCWD, argv[i]),
+ is = apk_bstream_gunzip_mpart(apk_bstream_from_file(AT_FDCWD, *parg),
apk_sign_ctx_mpart_cb, &sctx);
if (is == NULL) {
if (apk_verbosity >= 1)
- apk_error("%s: %s", argv[i], strerror(errno));
+ apk_error("%s: %s", *parg, strerror(errno));
else
- printf("%s\n", argv[i]);
+ printf("%s\n", *parg);
apk_sign_ctx_free(&sctx);
rc++;
continue;
@@ -40,11 +41,11 @@ static int verify_main(void *ctx, struct apk_database *db, int argc, char **argv
is->close(is);
ok = sctx.control_verified && sctx.data_verified;
if (apk_verbosity >= 1)
- apk_message("%s: %d - %s", argv[i], r,
+ apk_message("%s: %d - %s", *parg, r,
ok ? "OK" :
!sctx.control_verified ? "UNTRUSTED" : "FAILED");
else if (!ok)
- printf("%s\n", argv[i]);
+ printf("%s\n", *parg);
if (!ok)
rc++;
apk_sign_ctx_free(&sctx);