diff options
| author | Gisle Vanem <gvanem@broadpark.no> | 2005-05-14 05:58:52 +0000 | 
|---|---|---|
| committer | Gisle Vanem <gvanem@broadpark.no> | 2005-05-14 05:58:52 +0000 | 
| commit | 0c96056a943ee73b95e32208c4f0d2ae9b6e1e48 (patch) | |
| tree | 6eef263f923294cf7d20f1fce5a352dd9e2f4319 | |
| parent | f518a5e2316ad1a3d366af8aad60426574128811 (diff) | |
Change for systems with >1 ways of setting (non-)blocking
mode. (djgpp/Watt-32 has 3 ways). Should rewrite this using
"#elif ..", but maybe there is still broken cpp around?
| -rw-r--r-- | lib/connect.c | 16 | 
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/connect.c b/lib/connect.c index b603c12c8..4ab7af2bd 100644 --- a/lib/connect.c +++ b/lib/connect.c @@ -133,6 +133,7 @@ int Curl_nonblock(curl_socket_t sockfd,    /* operate on this */                    int nonblock   /* TRUE or FALSE */)  {  #undef SETBLOCK +#define SETBLOCK 0  #ifdef HAVE_O_NONBLOCK    /* most recent unix versions */    int flags; @@ -145,43 +146,48 @@ int Curl_nonblock(curl_socket_t sockfd,    /* operate on this */  #define SETBLOCK 1  #endif -#ifdef HAVE_FIONBIO +#if defined(HAVE_FIONBIO) && (SETBLOCK == 0)    /* older unix versions */    int flags;    flags = nonblock;    return ioctl(sockfd, FIONBIO, &flags); +#undef SETBLOCK  #define SETBLOCK 2  #endif -#ifdef HAVE_IOCTLSOCKET +#if defined(HAVE_IOCTLSOCKET) && (SETBLOCK == 0)    /* Windows? */    unsigned long flags;    flags = nonblock;    return ioctlsocket(sockfd, FIONBIO, &flags); +#undef SETBLOCK  #define SETBLOCK 3  #endif -#ifdef HAVE_IOCTLSOCKET_CASE +#if defined(HAVE_IOCTLSOCKET_CASE) && (SETBLOCK == 0)    /* presumably for Amiga */    return IoctlSocket(sockfd, FIONBIO, (long)nonblock); +#undef SETBLOCK  #define SETBLOCK 4  #endif -#ifdef HAVE_SO_NONBLOCK +#if defined(HAVE_SO_NONBLOCK) && (SETBLOCK == 0)    /* BeOS */    long b = nonblock ? 1 : 0;    return setsockopt(sockfd, SOL_SOCKET, SO_NONBLOCK, &b, sizeof(b)); +#undef SETBLOCK  #define SETBLOCK 5  #endif  #ifdef HAVE_DISABLED_NONBLOCKING    return 0; /* returns success */ +#undef SETBLOCK  #define SETBLOCK 6  #endif -#ifndef SETBLOCK +#if (SETBLOCK == 0)  #error "no non-blocking method was found/used/set"  #endif  }  | 
