The attached simple patches help compiling with Visual C++. I used the freebie "Visual Studio 2012 Express". In main.c: <dir.h> is neither available, nor needed. In output.c: reorder two lines, since declarations can appear only at the beginning of block (later MSVC's may have relaxed this, but it is nicer to keep code compatible with old ANSI C). Also added makefile.msv, which is compatible with the "nmake" that comes with Visual C++.
The makefile
output.c diff