submodule: Use cat instead of echo to avoid DOS line-endings
[git/dscho.git] / compat / msvc.h
bloba33b01c032b1ab948d87b29447ad0787c86f14f1
1 #ifndef __MSVC__HEAD
2 #define __MSVC__HEAD
4 #include <direct.h>
5 #include <process.h>
6 #include <malloc.h>
8 /* porting function */
9 #define inline __inline
10 #define __inline__ __inline
11 #define __attribute__(x)
12 #define strncasecmp _strnicmp
13 #define ftruncate _chsize
15 static __inline int strcasecmp (const char *s1, const char *s2)
17 int size1 = strlen(s1);
18 int sisz2 = strlen(s2);
19 return _strnicmp(s1, s2, sisz2 > size1 ? sisz2 : size1);
22 #undef ERROR
24 /* Use mingw_lstat() instead of lstat()/stat() and mingw_fstat() instead
25 * of fstat(). We add the declaration of these functions here, suppressing
26 * the corresponding declarations in mingw.h, so that we can use the
27 * appropriate structure type (and function) names from the msvc headers.
29 #define stat _stat64
30 int mingw_lstat(const char *file_name, struct stat *buf);
31 int mingw_fstat(int fd, struct stat *buf);
32 #define fstat mingw_fstat
33 #define lstat mingw_lstat
34 #define _stat64(x,y) mingw_lstat(x,y)
35 #define ALREADY_DECLARED_STAT_FUNCS
37 #include "compat/mingw.h"
39 #undef ALREADY_DECLARED_STAT_FUNCS
41 #endif