diff options
author | Natanael Copa <natanael.copa@gmail.com> | 2009-04-03 21:40:53 +0200 |
---|---|---|
committer | Natanael Copa <natanael.copa@gmail.com> | 2009-04-03 21:40:53 +0200 |
commit | 8fb4f6d17c41110f2f4c6d521e71701c2ef5a5b2 (patch) | |
tree | 7f30cc8336e659605f269b486d9d5a01c25add42 /src | |
parent | 53814250121339b9bdb3e2a403115673a23d5ad2 (diff) | |
download | apk-tools-8fb4f6d17c41110f2f4c6d521e71701c2ef5a5b2.tar.gz apk-tools-8fb4f6d17c41110f2f4c6d521e71701c2ef5a5b2.tar.bz2 apk-tools-8fb4f6d17c41110f2f4c6d521e71701c2ef5a5b2.tar.xz apk-tools-8fb4f6d17c41110f2f4c6d521e71701c2ef5a5b2.zip |
ver: added --check/-c option to vaildate given version string
Diffstat (limited to 'src')
-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 = { |