1
0
mirror of https://github.com/libssh2/libssh2.git synced 2025-08-07 08:02:56 +03:00

Carlo Bramini fixed the build for msys+mingw. Bug #1943976.

This commit is contained in:
Daniel Stenberg
2008-09-30 21:54:20 +00:00
parent d26a330483
commit 8c43bc52b1
4 changed files with 68 additions and 28 deletions

View File

@@ -12,36 +12,16 @@
#define HAVE_UNISTD_H
#define HAVE_INTTYPES_H
#define HAVE_SYS_TIME_H
/* defined into MS PSDK but not into Mingw w32api */
#define WINSOCK_VERSION MAKEWORD(2,0)
#endif
#define HAVE_WINSOCK2_H
#define HAVE_IOCTLSOCKET
#define HAVE_SELECT
/* same as WSABUF */
struct iovec {
u_long iov_len;
char *iov_base;
};
#define inline __inline
static inline int writev(int sock, struct iovec *iov, int nvecs)
{
DWORD ret;
if (WSASend(sock, (LPWSABUF)iov, nvecs, &ret, 0, NULL, NULL) == 0) {
return ret;
}
return -1;
}
/* not really usleep, but safe for the way we use it in this lib */
static inline int usleep(int udelay)
{
Sleep(udelay / 1000);
return 0;
}
#ifdef _MSC_VER
#define snprintf _snprintf
#if _MSC_VER < 1500
@@ -53,12 +33,8 @@ static inline int usleep(int udelay)
#define strncasecmp _strnicmp
#define strcasecmp _stricmp
#else
#ifdef __MINGW32__
#define WINSOCK_VERSION MAKEWORD(2,0)
#else
#define strncasecmp strnicmp
#define strcasecmp stricmp
#endif /* __MINGW32__ */
#endif /* _MSC_VER */
/* Compile in zlib support */