At the same time, Windows 95/98/ME never supported anything but 32-bit
x86, so its section can be simplified.
There is no need to "simplify" here. The goal of this uname() function is
to support all kinds of machines, even those to which we don't have
access to.
And even operating systems that were never ported? Windows 95/98/ME
_cannot_ be ported to other processors than x86 because of its
architecture (for the same reason why Wine cannot be ported to other
processors than x86).
+ default: /* 3.5, 4.0, versions not yet known */
+ sprintf (buf->release, "Windows NT %s %u.%u",
+ is_server ? "Server" : "Workstation",
+ (unsigned int) version.dwMajorVersion,
+ (unsigned int) version.dwMinorVersion);
I object against outputting "Windows NT" for the versions not yet known
(Windows 7, 8, who knows?). Returning "Windows" is suboptimal, but
acceptable. Returning "Windows NT" will be confusing for end users.
I'll make it only Windows Server/Windows.
+ switch ((version.dwMajorVersion<< 8)
+ | version.dwMinorVersion)
An idiom like this may save a couple of instructions at the expense of
readability of the code. When I look at the MS documentation of
OSVERSIONINFOEX, I see values 5, 6 mentioned, but I don't see 0x502,
0x601 etc. Consequence: This idiom makes the code harder to maintain.
But you do see the 5/0, 5/1, 5/2, 6/0, 6/1 pairs. I did it all but to
save instructions. It was more readable for me.
Paolo