Finding the XFree86 X Server Version From a Client

XFree86 Version Numbering Schemes : Finding the XFree86 X Server Version From a Client
Previous: Version Numbering Scheme for XFree86 3.3.x.
Next: XFree86 Version Numbering Schemes

## 6. Finding the XFree86 X Server Version From a Client

The XFree86 X servers report a `VendorRelease` value that matches the XFree86 version number. There have been some cases of releases where this value wasn't set correctly. The rules for interpreting this value as well as the known exceptions are outlined here.

For 3.3.x versions, the `VendorRelease` value is `Mmnp`. That is, version `M.m.n.p` has `VendorRelease` set to `M * 1000 + m * 100 + n * 10 + p`. Exceptions to this are: The value wasn't incremented for the 3.3.3.1 release, and for the 3.3.4 and 3.3.5 releases the value was incorrectly set to `Mmn` (`M * 100 + m * 10 + n`). This was corrected for the 3.3.6 release.

For versions 3.9.15 to 4.0.x, the `VendorRelease` value is `Mmnn`. That is, version `M.m.n` has `VendorRelease` set to `M * 1000 + m * 100 + n`. There have been no exceptions to this rule.

For post-4.0.2 development and release versions using the new numbering scheme, the `VendorRelease` value is `MMmmPPsss`. That is, version `M.m.P.s` has `VendorRelease` set to `M * 10000000 + m * 100000 + P * 1000 + s`. Note: 4.0.3 and any other 4.0.x releases will continue with the `Mmnn` scheme.

The following is a code fragment taken from `xdpyinfo.c` that shows how the `VendorRelease` information can be interpreted.

> `

>         if (strstr(ServerVendor(dpy), "XFree86")) {
>             int vendrel = VendorRelease(dpy);

>             printf("XFree86 version: ");
>             if (vendrel < 336) {
>                 /*
>                  * vendrel was set incorrectly for 3.3.4 and 3.3.5, so handle
>                  * those cases here.
>                  */
>                 printf("%d.%d.%d", vendrel / 100,
>                                   (vendrel / 10) % 10,
>                                    vendrel       % 10);
>             } else if (vendrel < 3900) {
>                 /* 3.3.x versions, other than the exceptions handled above */
>                 printf("%d.%d", vendrel / 1000,
>                                (vendrel /  100) % 10);
>                 if (((vendrel / 10) % 10) || (vendrel % 10)) {
>                     printf(".%d", (vendrel / 10) % 10);
>                     if (vendrel % 10) {
>                         printf(".%d", vendrel % 10);
>                     }
>                 }
>             } else if (vendrel < 40000000) {
>                 /* 4.0.x versions */
>                 printf("%d.%d", vendrel / 1000,
>                                (vendrel /   10) % 10);
>                 if (vendrel % 10) {
>                     printf(".%d", vendrel % 10);
>                 }
>             } else {
>                 /* post-4.0.x */
>                 printf("%d.%d.%d", vendrel / 10000000,
>                                   (vendrel /   100000) % 100,
>                                   (vendrel /     1000) % 100);
>                 if (vendrel % 1000) {
>                     printf(".%d", vendrel % 1000);
>                 }
>             }
>         }

> `

XFree86 Version Numbering Schemes : Finding the XFree86 X Server Version From a Client
Previous: Version Numbering Scheme for XFree86 3.3.x.
Next: XFree86 Version Numbering Schemes