summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Jackson <ajax@redhat.com>2022-02-10 12:01:57 -0500
committerAlan Coopersmith <alan.coopersmith@oracle.com>2022-04-06 22:01:23 +0000
commit47770a9bd7b8af662ebaeb56911bfd4ee7ca5b9b (patch)
treefa3684d1597bc05197c8eba6c4b227e41ca6580c
parent0cde4d53d3fea82004ccefef5a059287a6e9e861 (diff)
xdpyinfo: Fix printing the X.Org release version for xserver >= 21
Without this you'd get 1.21.1.4 instead of 21.1.4.
-rw-r--r--xdpyinfo.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/xdpyinfo.c b/xdpyinfo.c
index dda04c7..b201ad3 100644
--- a/xdpyinfo.c
+++ b/xdpyinfo.c
@@ -245,12 +245,19 @@ print_display_info(Display *dpy)
int vendrel = VendorRelease(dpy);
printf("X.Org version: ");
- printf("%d.%d.%d", vendrel / 10000000,
+ if (vendrel >= 12100000) {
+ vendrel -= 10000000; /* Y2.1K compliant */
+ printf("%d.%d",
(vendrel / 100000) % 100,
(vendrel / 1000) % 100);
- if (vendrel % 1000)
- printf(".%d", vendrel % 1000);
- printf("\n");
+ } else {
+ printf("%d.%d.%d", vendrel / 10000000,
+ (vendrel / 100000) % 100,
+ (vendrel / 1000) % 100);
+ }
+ if (vendrel % 1000)
+ printf(".%d", vendrel % 1000);
+ printf("\n");
}
else if (strstr(ServerVendor (dpy), "XFree86")) {
int vendrel = VendorRelease(dpy);