Comment by kazinator
5 years ago
I don't understand how this provides a POSIX API on Windows.
There is a tcsetattr function in Cosmopolitan.
If I use that to obtain character-a-a-time input with no echo, and then run the portable executable Windows, will that have the right effect in the console window?
Yup. See https://justine.lol/blinkenlights/blinkenlights-windows.png and https://github.com/jart/cosmopolitan/blob/fcfe7c108083962a3d... and https://github.com/jart/cosmopolitan/blob/fcfe7c108083962a3d... and https://github.com/jart/cosmopolitan/blob/fcfe7c108083962a3d... and https://github.com/jart/cosmopolitan/blob/fcfe7c108083962a3d... It's not perfect though. For example, right now Cosmopolitan won't do the really dirty hacks that Cygwin does to fully simulate POSIX like creating a virtual filesystem or spawning daemons and threads for handling signals. Cosmopolitan does however give you 90% the value at 10% the price. This has been great for my use case, since I'm mostly only concerned with greenfield development. I wanted the feel of POSIX but I didn't need to check off a box with a regulatory body that it conforms perfectly to POSIX. I'm also not trying to create a distro that leverages all the open source works written to date; Cygwin and MinGW are already doing a great job at that and I view Cosmopolitan as complementary.
I needed a way to port program to Windows with accurate POSIX, like Cygwin, but without the Cygwin paths and virtual file system and other user-visible quirks.
In under twenty or so fairly simple commits to a fork of the Cygwin DLL, I got it:
http://www.kylheku.com/cygnal/
This is another useful tool in this general arsenal.