Only the input/output functions from <unistd.h> options are used, so
using <io.h> when building with MSVC should be enough. The inclusion
of the header in context-priv.c does not seem to be needed (tested
on GNU/Linux) and so it is removed.
Signed-off-by: Ran Benita <ran@unusedvar.com>
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
-#include <unistd.h>
#include "xkbcommon/xkbcommon.h"
#include "utils.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
-#include <unistd.h>
+#ifdef _MSC_VER
+# include <direct.h>
+# include <io.h>
+# ifndef S_ISDIR
+# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
+# endif
+#else
+# include <unistd.h>
+#endif
#include "xkbcommon/xkbcommon.h"
#include "utils.h"
#include <limits.h>
#include <fcntl.h>
+#ifdef _MSC_VER
+#include <io.h>
+#else
#include <unistd.h>
+#endif
#include <sys/types.h>
#include <sys/stat.h>
#include <termios.h>
#include <sys/stat.h>
#include <sys/types.h>
-#include <unistd.h>
+#ifdef _MSC_VER
+# include <io.h>
+# include <direct.h>
+# ifndef S_ISDIR
+# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
+# endif
+#else
+# include <unistd.h>
+#endif
/* keeps a cache of all makedir/maketmpdir directories so we can free and
* rmdir them in one go, see unmakedirs() */