FIXME: take the UNIX branch in buf_write

- While we test this tell buf_write() we are UNIX
Mingw: use _MAX_PATH for path len
Set TEMPDIRNAMES for Mingw

- It turns out Windows does açmost the same as UNIX when trying
  to find the temp path, TEMPDIRNAMES does almost the same as the
  native Windows function GetTempPath
FIXME: Mingw does not have mkdtemp