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 sock_make_blocking(fd) fcntl(fd, F_SETFL, 0) |
---|
9 | #define sockerr_again() (errno == EINPROGRESS || errno == EINTR) |
---|
10 | #define closesocket(a) close(a) |
---|
11 | #else |
---|
12 | # include <winsock2.h> |
---|
13 | # if !defined(BITLBEE_CORE) && defined(_MSC_VER) |
---|
14 | # pragma comment(lib,"bitlbee.lib") |
---|
15 | # endif |
---|
16 | # include <io.h> |
---|
17 | # define read(a,b,c) recv(a,b,c,0) |
---|
18 | # define write(a,b,c) send(a,b,c,0) |
---|
19 | # define sock_make_nonblocking(fd) { int non_block = 1; ioctlsocket(fd, FIONBIO, &non_block); } |
---|
20 | # define sock_make_blocking(fd) { int non_block = 0; ioctlsocket(fd, FIONBIO, &non_block); } |
---|
21 | # define sockerr_again() (WSAGetLastError() == WSAEINTR || WSAGetLastError() == WSAEINPROGRESS || WSAGetLastError() == WSAEWOULDBLOCK) |
---|
22 | # define ETIMEDOUT WSAETIMEDOUT |
---|
23 | # define sleep(a) Sleep(a*1000) |
---|
24 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.