Mostly nonfunctional changes to compile under MinGW.
ifdefed out some of the old SunOS code to compile under MinGW.