diff options
Diffstat (limited to 'src/ver.c')
-rw-r--r-- | src/ver.c | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -45,6 +45,19 @@ static int ver_test(int argc, char **argv) return 0; } +static int ver_validate(int argc, char **argv) +{ + int i, r = 0; + for (i = 0; i < argc; i++) { + if (!apk_version_validate(APK_BLOB_STR(argv[i]))) { + if (apk_verbosity > 0) + printf("%s\n", argv[i]); + r++; + } + } + return r; +} + static int ver_parse(void *ctx, int opt, int optindex, const char *optarg) { struct ver_ctx *ictx = (struct ver_ctx *) ctx; @@ -52,6 +65,9 @@ static int ver_parse(void *ctx, int opt, int optindex, const char *optarg) case 't': ictx->action = ver_test; break; + case 'c': + ictx->action = ver_validate; + break; default: return -1; } @@ -93,6 +109,7 @@ static int ver_main(void *ctx, int argc, char **argv) static struct option ver_options[] = { { "test", no_argument, NULL, 't' }, + { "check", no_argument, NULL, 'c' }, }; static struct apk_applet apk_ver = { |