merging Paul Ringseth cygwin patch - thanks Paul