[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 4/8] Test for number of mkdir() arguments
From: |
Ladislav Michl |
Subject: |
[PATCH v2 4/8] Test for number of mkdir() arguments |
Date: |
Tue, 4 Dec 2018 22:24:52 +0100 |
User-agent: |
Mutt/1.10.1 (2018-07-13) |
Windows' mkdir() takes only 1 argument, so add a test for that.
---
CHANGES:
v2: dropped MSVC change as unrelated
configure.ac | 1 +
include/compat.h | 15 ++++++++++++++-
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index a5648fe5..b2892d27 100644
--- a/configure.ac
+++ b/configure.ac
@@ -898,6 +898,7 @@ AC_PROG_GCC_TRADITIONAL
AC_FUNC_MEMCMP
AC_TYPE_SIGNAL
AC_FUNC_STRFTIME
+AC_FUNC_MKDIR
AC_CHECK_FUNCS(mktime timegm gettimeofday select poll wcrtomb)
AC_CHECK_FUNCS(strchr strdup strndup strstr strtol strtok strsep)
AC_CHECK_FUNCS(asprintf vasprintf snprintf vsnprintf getpass setenv)
diff --git a/include/compat.h b/include/compat.h
index acb91fc6..cae13a69 100644
--- a/include/compat.h
+++ b/include/compat.h
@@ -207,6 +207,20 @@ int vasprintf(char **ptr, const char *format, va_list ap);
time_t timegm(struct tm *tm);
#endif
+#if HAVE_MKDIR
+# if MKDIR_TAKES_ONE_ARG
+ /* Mingw32 */
+# define mkdir(a,b) mkdir(a)
+# endif
+#else
+# if HAVE__MKDIR
+ /* plain Win32 */
+# define mkdir(a,b) _mkdir(a)
+# else
+# error "Don't know how to create a directory on this system."
+# endif
+#endif
+
/*
* The following code was taken from W. Richard Stevens'
* "UNIX Network Programming", Volume 1, Second Edition.
--
2.20.0.rc2
[PATCH v2 4/8] Test for number of mkdir() arguments,
Ladislav Michl <=
[PATCH 8/8] Remove cfg_foreach, Ladislav Michl, 2018/12/04
[PATCH v2 6/8] Refactor devices build, Ladislav Michl, 2018/12/04
[PATCH v2 7/8] Use posix_spawn to run external scripts, Ladislav Michl, 2018/12/04
[PATCH 5/8] Fix compat.c compilation with mingw32, Ladislav Michl, 2018/12/04