Ignore:
Timestamp:
Jun 30, 2010, 9:24:36 PM (11 years ago)
Author:
charles
Message:

(trunk) #3311 "MingW build of Transmission" -- apply more of rb07's diffs, though edited to lessen the inevitable #ifdefs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/tr-lpd.c

    r10912 r10913  
    2626
    2727/* posix */
    28 #include <netinet/in.h> /* sockaddr_in */
    2928#include <signal.h> /* sig_atomic_t */
    3029#include <sys/time.h>
    31 #include <sys/types.h>
    32 #include <sys/socket.h> /* socket(), bind() */
    3330#include <unistd.h> /* close() */
    3431#include <fcntl.h> /* fcntl(), O_NONBLOCK */
    3532#include <ctype.h> /* toupper() */
     33#ifdef WIN32
     34  #include <w32api.h>
     35  #define WINDOWS  WindowsXP  /* freeaddrinfo(),getaddrinfo(),getnameinfo() */
     36  #include <inttypes.h>
     37  #include <ws2tcpip.h>
     38  typedef uint16_t in_port_t;                   /* all missing */
     39  extern int fcntl (int fd, int cmd, ...);
     40  #define O_NONBLOCK    04000
     41#else
     42  #include <sys/types.h>
     43  #include <sys/socket.h> /* socket(), bind() */
     44  #include <netinet/in.h> /* sockaddr_in */
     45#endif
    3646
    3747/* third party */
     
    247257static inline int lpd_configureSocket( int sock, int add )
    248258{
     259#ifdef WIN32
     260    unsigned long flags = 1;
     261
     262    if (add != O_NONBLOCK)
     263        return -1;              /* not supported */
     264    if (ioctlsocket(sock, FIONBIO, &flags) == SOCKET_ERROR)
     265        return -1;
     266#else
    249267    /* read-modify-write socket flags */
    250268    int flags = fcntl( sock, F_GETFL );
     
    255273    if( fcntl( sock, F_SETFL, add | flags ) == -1 )
    256274        return -1;
     275#endif
    257276
    258277    return add;
Note: See TracChangeset for help on using the changeset viewer.