summaryrefslogtreecommitdiff
path: root/src/utils.h
diff options
context:
space:
mode:
authorRan Benita <ran@unusedvar.com>2022-09-24 10:37:06 +0300
committerRan Benita <ran@unusedvar.com>2022-09-24 12:31:53 +0300
commit4d8293901b89863f8d024cf2ed9138f4f6133196 (patch)
tree6bd36aacf65f9e853103bd37f1f93d2637c757f6 /src/utils.h
parentb309514247996d55f6ef33e530a722e2431c2fdb (diff)
downloadxorg-lib-libxkbcommon-4d8293901b89863f8d024cf2ed9138f4f6133196.tar.gz
utils: move some MSVC compat stuff to common place
Signed-off-by: Ran Benita <ran@unusedvar.com>
Diffstat (limited to 'src/utils.h')
-rw-r--r--src/utils.h18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/utils.h b/src/utils.h
index 7557dab..c263635 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -31,13 +31,21 @@
#include <stdio.h>
#include <string.h>
#if HAVE_UNISTD_H
-#include <unistd.h>
+# include <unistd.h>
#else
/* Required on Windows where unistd.h doesn't exist */
-#define R_OK 4 /* Test for read permission. */
-#define W_OK 2 /* Test for write permission. */
-#define X_OK 1 /* Test for execute permission. */
-#define F_OK 0 /* Test for existence. */
+# define R_OK 4 /* Test for read permission. */
+# define W_OK 2 /* Test for write permission. */
+# define X_OK 1 /* Test for execute permission. */
+# define F_OK 0 /* Test for existence. */
+#endif
+
+#ifdef _MSC_VER
+# include <direct.h>
+# include <io.h>
+# ifndef S_ISDIR
+# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
+# endif
#endif
#include "darray.h"