Update version of tools
[src/app-framework-main.git] / src / wgtpkg-installer.c
index 855e28d..6738192 100644 (file)
@@ -39,6 +39,20 @@ static const char appname[] = "wgtpkg-installer";
 static const char *root;
 static int force;
 
+static void version()
+{
+       printf(
+               "\n"
+               "  %s  version="AFM_VERSION"\n"
+               "\n"
+               "  Copyright (C) 2015, 2016, 2017 \"IoT.bzh\"\n"
+               "  AFB comes with ABSOLUTELY NO WARRANTY.\n"
+               "  Licence Apache 2\n"
+               "\n",
+               appname
+       );
+}
+
 static void usage()
 {
        printf(
@@ -49,6 +63,7 @@ static void usage()
                "   -f            force overwriting\n"
                "   -q            quiet\n"
                "   -v            verbose\n"
+               "   -V            version\n"
                "\n",
                appname
        );
@@ -60,6 +75,7 @@ static struct option options[] = {
        { "help",        no_argument,       NULL, 'h' },
        { "quiet",       no_argument,       NULL, 'q' },
        { "verbose",     no_argument,       NULL, 'v' },
+       { "version",     no_argument,       NULL, 'V' },
        { NULL, 0, NULL, 0 }
 };
 
@@ -75,7 +91,7 @@ int main(int ac, char **av)
 
        force = 0;
        for (;;) {
-               i = getopt_long(ac, av, "hfqvp:", options, NULL);
+               i = getopt_long(ac, av, "hfqvVp:", options, NULL);
                if (i < 0)
                        break;
                switch (i) {
@@ -92,6 +108,9 @@ int main(int ac, char **av)
                case 'v':
                        verbosity++;
                        break;
+               case 'V':
+                       version();
+                       return 0;
                case 'p':
                        rc = grant_permission_list(optarg);
                        if (rc < 0) {