source: sock.h @ 4146a07

Last change on this file since 4146a07 was 4146a07, checked in by Jelmer Vernooij <jelmer@…>, at 2005-12-17T01:25:32Z

Fix win32 build using mingw32 on linux (no ssl and yahoo yet though)

  • Property mode set to 100644
File size: 801 bytes
Line 
1#ifndef _WIN32
2#include <unistd.h>
3#include <sys/socket.h>
4#include <netinet/in.h>
5#include <arpa/inet.h>
6#include <netdb.h>
7#define sock_make_nonblocking(fd) fcntl(fd, F_SETFL, O_NONBLOCK)
8#define sockerr_again() (errno == EINPROGRESS || errno == EINTR)
9#define closesocket(a) close(a)
10#else
11# include <winsock2.h>
12# if !defined(BITLBEE_CORE) && defined(_MSC_VER)
13#   pragma comment(lib,"bitlbee.lib")
14# endif
15# include <io.h>
16# define read(a,b,c) recv(a,b,c,0)
17# define write(a,b,c) send(a,b,c,0)
18# define sock_make_nonblocking(fd) { int non_block = 1; ioctlsocket(fd, FIONBIO, &non_block); }
19# define sockerr_again() (WSAGetLastError() == WSAEINTR || WSAGetLastError() == WSAEINPROGRESS || WSAGetLastError() == WSAEWOULDBLOCK)
20# define ETIMEDOUT WSAETIMEDOUT
21# define sleep(a) Sleep(a*1000)
22#endif
Note: See TracBrowser for help on using the repository browser.