Tool for checking tree integrity v1.02 01/92001/1
authorLukasz Wlazly <l.wlazly@partner.samsung.com>
Wed, 12 Oct 2016 13:28:33 +0000 (15:28 +0200)
committerLukasz Wlazly <l.wlazly@partner.samsung.com>
Wed, 12 Oct 2016 13:29:05 +0000 (15:29 +0200)
Change-Id: I1fe9ca1f3eaf7af2325d3248cacaa8cabc6d14cd

test/at_spi2_tool.c

index 8c6bc6f..1a951da 100644 (file)
@@ -17,6 +17,7 @@
 #define DUMP 0
 #define CHECK 1
 #define FIRST_MATCH 2
+#define VERSION "1.02"
 
 static unsigned indent_width = 2;
 static int module_name_limit = -1;
@@ -357,6 +358,7 @@ void _print_help()
        printf("USAGE: at_spi2_tool [OPTION] [PARAMETER] ...\n\n");
        printf("OPTION LIST:\n");
        printf("-h, --help\t\tshow this message\n");
+       printf("-v, --version\t\tshow actual version of tool\n");
        printf("-g, --show-legend\tprint AT-SPI state legend\n");
        printf("-l, --list-apps\t\tlist all applications of desktop\n");
        printf("-d, --tree-dump\t\tdump tree for selected application\n");
@@ -370,6 +372,10 @@ void _print_help()
        printf("\tat_spi2_tool -i1 -c starter\n");
        printf("\t  show AT-SPI tree with integrity test for node \"starter\" using one-space indentation\n");
 }
+void _print_version()
+{
+       printf("AT-SPI2-CORE-UTIL v%s\n", VERSION);
+}
 
 static void _atspi_tree_traverse(AtspiAccessible *desktop, const char *app_name, bool dump, bool check, bool first_match, int length_limit)
 {
@@ -412,6 +418,7 @@ static void _run_command(int argc, char *argv[], AtspiAccessible *desktop)
 {
        struct option long_options[] = {
                {"help", no_argument, 0, 'h'},
+               {"version", no_argument, 0, 'v'},
                {"show-legend", no_argument, 0, 'g'},
                {"list-apps", no_argument, 0, 'l'},
                {"tree-dump", required_argument, 0, 'd'},
@@ -427,7 +434,7 @@ static void _run_command(int argc, char *argv[], AtspiAccessible *desktop)
        char *app_name = NULL;
 
        while (TRUE) {
-               command = getopt_long(argc, argv, "hgld:c:ft:i:", long_options, &option_index);
+               command = getopt_long(argc, argv, "hvgld:c:ft:i:", long_options, &option_index);
 
                if (command == ERROR_STATE)
                        break;
@@ -437,6 +444,10 @@ static void _run_command(int argc, char *argv[], AtspiAccessible *desktop)
                        _print_help();
                        break;
 
+               case 'v':
+                       _print_version();
+                       break;
+
                case 'g':
                        _print_atspi_states_legend();
                        break;