diff options
author | Adam Jackson <ajax@redhat.com> | 2022-02-10 12:01:57 -0500 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2022-04-06 22:01:23 +0000 |
commit | 47770a9bd7b8af662ebaeb56911bfd4ee7ca5b9b (patch) | |
tree | fa3684d1597bc05197c8eba6c4b227e41ca6580c /xdpyinfo.c | |
parent | 0cde4d53d3fea82004ccefef5a059287a6e9e861 (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.
Diffstat (limited to 'xdpyinfo.c')
-rw-r--r-- | xdpyinfo.c | 15 |
1 files changed, 11 insertions, 4 deletions
@@ -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); |