--- a/dav/main.c Tue Sep 12 21:07:54 2023 +0200 +++ b/dav/main.c Thu Sep 14 18:11:50 2023 +0200 @@ -32,18 +32,18 @@ #include <string.h> #include <stdbool.h> #include <errno.h> -#include <unistd.h> #include <time.h> #include <sys/types.h> #ifndef _WIN32 #include <sys/wait.h> +#include <unistd.h> #endif #include <cx/string.h> #include <cx/utils.h> #include <cx/printf.h> #include <cx/hash_map.h> #include <cx/linked_list.h> -#include <dirent.h> + #include <libidav/utils.h> #include <libidav/crypto.h> @@ -82,6 +82,9 @@ int dav_main(int argc, char **argv); #ifdef _WIN32 + +#define strcasecmp _stricmp + static char* wchar2utf8(const wchar_t *wstr, size_t wlen) { size_t maxlen = wlen * 4; char *ret = malloc(maxlen + 1); @@ -1205,6 +1208,18 @@ return ret; } +#if !defined(S_ISREG) && defined(S_IFMT) && defined(S_IFREG) +#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) +#endif + +#ifdef _WIN32 +#ifndef S_ISDIR +#define S_ISDIR(mode) ((mode) & _S_IFMT) == _S_IFDIR +#define S_ISREG(mode) ((mode) & _S_IFMT) == _S_IFREG +#endif +#endif + + int put_entry( Repository *repo, CmdArgs *a,