1#ifndef __MSVC__HEAD
2#define __MSVC__HEAD
3
4#include <direct.h>
5#include <process.h>
6#include <malloc.h>
7
8/* porting function */
9#define inline __inline
10#define __inline__ __inline
11#define __attribute__(x)
12#define strncasecmp _strnicmp
13#define ftruncate _chsize
14
15static __inline int strcasecmp (const char *s1, const char *s2)
16{
17 int size1 = strlen(s1);
18 int sisz2 = strlen(s2);
19 return _strnicmp(s1, s2, sisz2 > size1 ? sisz2 : size1);
20}
21
22#undef ERROR
23
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.
28 */
29#define stat _stat64
30int mingw_lstat(const char *file_name, struct stat *buf);
31int 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
36
37#include "compat/mingw.h"
38
39#undef ALREADY_DECLARED_STAT_FUNCS
40
41#endif