Fix compilation on Mac OS which lacks _strupr, _strlwr, and _unlink

These changes allow your branch to compile on Mac OS.

I think the updated calls should work fine on Windows and most POSIX systems.