summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2024-04-18 12:23:45 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2024-04-18 12:24:58 -0700
commitcb073d318328d8ac2df64aed195d933cf64b5358 (patch)
treeeab018c45fca2e7f921a597e3677b4719442084f
parent16fda0825a0c6a51f800c225e66adce65e5f327c (diff)
Add -version option
(Also accepts but does not document --version) Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Part-of: <https://gitlab.freedesktop.org/xorg/test/x11perf/-/merge_requests/10>
-rw-r--r--man/x11perf.man3
-rw-r--r--x11perf.c7
2 files changed, 9 insertions, 1 deletions
diff --git a/man/x11perf.man b/man/x11perf.man
index 843215f..dccc476 100644
--- a/man/x11perf.man
+++ b/man/x11perf.man
@@ -248,6 +248,9 @@ Perform only x11perf Version 1.6 tests using Version 1.6 semantics.
.B \-v1.7
Perform only x11perf Version 1.7 tests using Version 1.7 semantics.
.TP 14
+.B \-version
+Print program version and exit.
+.TP 14
.B \-su
Set the save_under window attribute to True on all windows created by x11perf.
Default is False.
diff --git a/x11perf.c b/x11perf.c
index 8018bf7..cea0351 100644
--- a/x11perf.c
+++ b/x11perf.c
@@ -358,7 +358,7 @@ Get_Display_Name(int *pargc, /* MODIFIED */
/*
* GetVersion (argc, argv) Look for -v followed by a version number.
* If found remove it from command line. Don't go past a lone -.
- * Leave -v followed by non-numbers as it could be -vclass.
+ * Leave -v followed by non-numbers as it could be -vclass or -version.
*/
static Version
@@ -500,6 +500,7 @@ usage(void)
" -v1.5 perform only v1.5 tests using old semantics\n"
" -v1.6 perform only v1.6 tests using old semantics\n"
" -v1.7 perform only v1.7 tests using old semantics\n"
+" -version print version and exit\n"
" -su request save unders on windows\n"
" -bs <backing_store_hint> WhenMapped or Always (default = NotUseful)\n"
;
@@ -1069,6 +1070,10 @@ main(int argc, char *argv[])
} else if (strcmp(argv[i], "Always") == 0) {
xparms.backing_store = Always;
} else usage ();
+ } else if ((strcmp(argv[i], "-version") == 0) ||
+ (strcmp(argv[i], "--version") == 0)) {
+ puts(PACKAGE_STRING);
+ exit(EXIT_SUCCESS);
} else {
int len,found;
ForEachTest (j) {