This is based on a patch by Esa Ilari Vuokko. I had a lot of difficulty getting Cygwin set up so I didn't test the changes under Cygwin, but I tested them under Ubuntu and MSYS/MinGW.

- Brian