wren-cli icon indicating copy to clipboard operation
wren-cli copied to clipboard

Use uname(3) to get platform name via POSIX API

Open RealDeuce opened this issue 11 months ago • 1 comments

Since unix implies POSIX, and even POSIX.1 included uname(3), we can simply ask a POSIX system what the system name is.

While some compilers don't define unix for some platforms (ie: clang on macOS), it appears that every platform that defines unix at least has the POSIX unistd.h header.

RealDeuce avatar Mar 13 '24 20:03 RealDeuce

The __APPLE__ and __linux__ blocks could alse be switched to using uname, and the test for unistd.h could be expanded to #if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))) (as mentioned here), but there's presumably value in stable strings for the common targets (presumably, macOS returns "macOS" not "OS X" now for example).

RealDeuce avatar Mar 13 '24 20:03 RealDeuce