Commit 8fb4f6d1 authored by Natanael Copa's avatar Natanael Copa

ver: added --check/-c option to vaildate given version string

parent 53814250
......@@ -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 = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment