[PATCH 5/8] Test for number of mkdir() arguments
Ladislav Michl <[email protected]> Mon, 3 Dec 2018 10:42:06 +0100
| Newsgroups | gmane.linux.drivers.gnokii |
|---|---|
| Message-ID | <20181203094206.GF18391@lenoch> |
Windows' mkdir() takes only 1 argument, so add a test for that. --- configure.ac | 1 + include/compat.h | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 379c7412..cd2064dd 100644 --- a/configure.ac +++ b/configure.ac @@ -902,6 +902,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 009f5f0e..8711c425 100644 --- a/include/compat.h +++ b/include/compat.h @@ -199,6 +199,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. @@ -219,7 +233,6 @@ time_t timegm(struct tm *tm); #ifdef WIN32 # ifdef _MSC_VER # define inline __inline -# define mkdir(dirname, accessrights) _mkdir(dirname) # define strcasecmp _stricmp # define strncasecmp _strnicmp # define __const const -- 2.20.0.rc1