summaryrefslogtreecommitdiff
path: root/x11perf.c
diff options
context:
space:
mode:
Diffstat (limited to 'x11perf.c')
-rw-r--r--x11perf.c87
1 files changed, 46 insertions, 41 deletions
diff --git a/x11perf.c b/x11perf.c
index 3939f02..8018bf7 100644
--- a/x11perf.c
+++ b/x11perf.c
@@ -356,8 +356,9 @@ Get_Display_Name(int *pargc, /* MODIFIED */
/*
- * GetVersion (argc, argv) Look for -v1.2, -v1.3, or -v1.4.
+ * 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.
*/
static Version
@@ -366,49 +367,53 @@ GetVersion(int *pargc, /* MODIFIED */
{
int argc = *pargc;
char **pargv = argv+1;
- Version version = VERSION1_6;
+ Version version = VERSION1_7;
Bool found = False;
for (int i = 1; i != argc; i++) {
char *arg = argv[i];
- if (!strcmp (arg, "-v1.2")) {
- version = VERSION1_2;
- *pargc -= 1;
- if (found) {
- fprintf(stderr, "Warning: multiple version specifications\n");
- }
- found = True;
- continue;
- }
- if (!strcmp (arg, "-v1.3")) {
- version = VERSION1_3;
- *pargc -= 1;
- if (found) {
- fprintf(stderr, "Warning: multiple version specifications\n");
- }
- found = True;
- continue;
- }
- if (!strcmp (arg, "-v1.4")) {
- version = VERSION1_4;
- *pargc -= 1;
- if (found) {
- fprintf(stderr, "Warning: multiple version specifications\n");
- }
- found = True;
- continue;
- }
- if (!strcmp (arg, "-v1.5")) {
- version = VERSION1_5;
- *pargc -= 1;
- if (found) {
- fprintf(stderr, "Warning: multiple version specifications\n");
+ if (arg[0] == '-' && arg[1] == 'v') {
+ if (arg[2] == '1' && arg[3] == '.' && arg[5] == '\0') {
+ switch (arg[4]) {
+ case '2':
+ version = VERSION1_2;
+ break;
+ case '3':
+ version = VERSION1_3;
+ break;
+ case '4':
+ version = VERSION1_4;
+ break;
+ case '5':
+ version = VERSION1_5;
+ break;
+ case '6':
+ version = VERSION1_6;
+ break;
+ case '7':
+ version = VERSION1_7;
+ break;
+ default:
+ goto unknown_version;
+ }
+
+ if (found) {
+ fprintf(stderr, "Warning: multiple version specifications\n");
+ }
+ found = True;
+
+ /* reduce arg count and skip copying this arg to pargv */
+ *pargc -= 1;
+ continue;
+ } else if (isdigit(arg[2])) {
+ unknown_version:
+ fprintf(stderr, "Error: unknown version specification: %s\n",
+ arg);
+ exit(1);
}
- found = True;
- continue;
}
- if (!strcmp(arg,"-")) {
+ else if (!strcmp(arg,"-")) {
while (i<argc) *pargv++ = argv[i++];
break;
}
@@ -491,6 +496,10 @@ usage(void)
" -subs <s0 s1 ...> a list of the number of sub-windows to use\n"
" -v1.2 perform only v1.2 tests using old semantics\n"
" -v1.3 perform only v1.3 tests using old semantics\n"
+" -v1.4 perform only v1.4 tests using old semantics\n"
+" -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"
" -su request save unders on windows\n"
" -bs <backing_store_hint> WhenMapped or Always (default = NotUseful)\n"
;
@@ -1049,10 +1058,6 @@ main(int argc, char *argv[])
} else if (strcmp(argv[i], "-subs") == 0) {
skip = GetNumbers (i+1, argc, argv, subWindows, &numSubWindows);
i += skip;
- } else if (strcmp(argv[i], "-v1.2") == 0) {
- xparms.version = VERSION1_2;
- } else if (strcmp(argv[i], "-v1.3") == 0) {
- xparms.version = VERSION1_3;
} else if (strcmp(argv[i], "-su") == 0) {
xparms.save_under = True;
} else if (strcmp(argv[i], "-bs") == 0) {