Merge branch 'jc/branch-desc-typoavoidance' into maint
[alt-git.git] / compat / msvc.h
blobaa4b56315ae2488ea656d695f0f660e4dbd745ef
1 #ifndef __MSVC__HEAD
2 #define __MSVC__HEAD
4 #include <direct.h>
5 #include <process.h>
6 #include <malloc.h>
7 #include <io.h>
9 /* porting function */
10 #define inline __inline
11 #define __inline__ __inline
12 #define __attribute__(x)
13 #define strncasecmp _strnicmp
14 #define ftruncate _chsize
16 static __inline int strcasecmp (const char *s1, const char *s2)
18 int size1 = strlen(s1);
19 int sisz2 = strlen(s2);
20 return _strnicmp(s1, s2, sisz2 > size1 ? sisz2 : size1);
23 #undef ERROR
25 /* Use mingw_lstat() instead of lstat()/stat() and mingw_fstat() instead
26 * of fstat(). We add the declaration of these functions here, suppressing
27 * the corresponding declarations in mingw.h, so that we can use the
28 * appropriate structure type (and function) names from the msvc headers.
30 #define stat _stat64
31 int mingw_lstat(const char *file_name, struct stat *buf);
32 int mingw_fstat(int fd, struct stat *buf);
33 #define fstat mingw_fstat
34 #define lstat mingw_lstat
35 #define _stat64(x,y) mingw_lstat(x,y)
36 #define ALREADY_DECLARED_STAT_FUNCS
38 #include "compat/mingw.h"
40 #undef ALREADY_DECLARED_STAT_FUNCS
42 #endif