dav/main.c

changeset 789
378b5ab86f77
parent 788
9b9420041d8e
child 795
05647e862a17
equal deleted inserted replaced
788:9b9420041d8e 789:378b5ab86f77
30 #include <stdio.h> 30 #include <stdio.h>
31 #include <stdlib.h> 31 #include <stdlib.h>
32 #include <string.h> 32 #include <string.h>
33 #include <stdbool.h> 33 #include <stdbool.h>
34 #include <errno.h> 34 #include <errno.h>
35 #include <unistd.h>
36 #include <time.h> 35 #include <time.h>
37 #include <sys/types.h> 36 #include <sys/types.h>
38 #ifndef _WIN32 37 #ifndef _WIN32
39 #include <sys/wait.h> 38 #include <sys/wait.h>
39 #include <unistd.h>
40 #endif 40 #endif
41 #include <cx/string.h> 41 #include <cx/string.h>
42 #include <cx/utils.h> 42 #include <cx/utils.h>
43 #include <cx/printf.h> 43 #include <cx/printf.h>
44 #include <cx/hash_map.h> 44 #include <cx/hash_map.h>
45 #include <cx/linked_list.h> 45 #include <cx/linked_list.h>
46 #include <dirent.h> 46
47 47
48 #include <libidav/utils.h> 48 #include <libidav/utils.h>
49 #include <libidav/crypto.h> 49 #include <libidav/crypto.h>
50 #include <libidav/session.h> 50 #include <libidav/session.h>
51 #include <libidav/xml.h> 51 #include <libidav/xml.h>
80 } 80 }
81 81
82 int dav_main(int argc, char **argv); 82 int dav_main(int argc, char **argv);
83 83
84 #ifdef _WIN32 84 #ifdef _WIN32
85
86 #define strcasecmp _stricmp
87
85 static char* wchar2utf8(const wchar_t *wstr, size_t wlen) { 88 static char* wchar2utf8(const wchar_t *wstr, size_t wlen) {
86 size_t maxlen = wlen * 4; 89 size_t maxlen = wlen * 4;
87 char *ret = malloc(maxlen + 1); 90 char *ret = malloc(maxlen + 1);
88 int ret_len = WideCharToMultiByte( 91 int ret_len = WideCharToMultiByte(
89 CP_UTF8, 92 CP_UTF8,
1203 free(path); 1206 free(path);
1204 dav_session_destroy(sn); 1207 dav_session_destroy(sn);
1205 return ret; 1208 return ret;
1206 } 1209 }
1207 1210
1211 #if !defined(S_ISREG) && defined(S_IFMT) && defined(S_IFREG)
1212 #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
1213 #endif
1214
1215 #ifdef _WIN32
1216 #ifndef S_ISDIR
1217 #define S_ISDIR(mode) ((mode) & _S_IFMT) == _S_IFDIR
1218 #define S_ISREG(mode) ((mode) & _S_IFMT) == _S_IFREG
1219 #endif
1220 #endif
1221
1222
1208 int put_entry( 1223 int put_entry(
1209 Repository *repo, 1224 Repository *repo,
1210 CmdArgs *a, 1225 CmdArgs *a,
1211 DavSession *sn, 1226 DavSession *sn,
1212 char *path, 1227 char *path,

mercurial