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