Changeset 3933


Ignore:
Timestamp:
11/18/09 14:23:58 (4 years ago)
Author:
sam
Message:

Add a VS 2010 solution file and make the code build again for Win32.

Location:
zzuf/trunk
Files:
3 added
2 edited

Legend:

Unmodified
Added
Removed
  • zzuf/trunk/msvc/config.h

    r2562 r3933  
    1717 */ 
    1818 
    19 #define VERSION "0.7 (msvc)" 
     19#define PACKAGE_VERSION "0.7 (msvc)" 
    2020#define SONAME "libzzuf.dll" 
     21 
     22#define ATTRIBUTE_PRINTF(x,y) 
    2123 
    2224#define HAVE_WINDOWS_H 1 
  • zzuf/trunk/src/network.c

    r3635 r3933  
    2727#include <stdlib.h> 
    2828#include <string.h> 
    29 #include <sys/socket.h> 
    30 #include <netinet/in.h> 
    31 #include <arpa/inet.h> 
     29#if defined HAVE_SYS_SOCKET_H 
     30#   include <sys/socket.h> 
     31#   include <netinet/in.h> 
     32#   include <arpa/inet.h> 
     33#endif 
    3234 
    3335#include "libzzuf.h" 
     
    3638#include "network.h" 
    3739 
     40#if defined HAVE_SYS_SOCKET_H 
    3841static unsigned int get_socket_ip(int); 
    3942static int host_in_list(unsigned int, unsigned int const *); 
     
    4952static int *ports = NULL; 
    5053static int static_ports[512]; 
     54#endif 
    5155 
    5256void _zz_network_init(void) 
     
    5761void _zz_network_fini(void) 
    5862{ 
     63#if defined HAVE_SYS_SOCKET_H 
    5964    if(ports != static_ports) 
    6065        free(ports); 
     
    6368    if(deny != static_deny) 
    6469        free(deny); 
     70#endif 
    6571} 
    6672 
    6773void _zz_allow(char const *allowlist) 
    6874{ 
     75#if defined HAVE_SYS_SOCKET_H 
    6976    allow = create_host_list(allowlist, static_allow); 
     77#endif 
    7078} 
    7179 
    7280void _zz_deny(char const *denylist) 
    7381{ 
     82#if defined HAVE_SYS_SOCKET_H 
    7483    deny = create_host_list(denylist, static_deny); 
     84#endif 
    7585} 
    7686 
    7787void _zz_ports(char const *portlist) 
    7888{ 
     89#if defined HAVE_SYS_SOCKET_H 
    7990    ports = _zz_allocrange(portlist, static_ports); 
     91#endif 
    8092} 
    8193 
    8294int _zz_portwatched(int port) 
    8395{ 
     96#if defined HAVE_SYS_SOCKET_H 
    8497    if(!ports) 
    8598        return 1; 
    8699 
    87100    return _zz_isinrange(port, ports); 
     101#else 
     102    return 0; 
     103#endif 
    88104} 
    89105 
    90106int _zz_hostwatched(int sock) 
    91107{ 
     108#if defined HAVE_SYS_SOCKET_H 
    92109    int watch = 1; 
    93110    unsigned int ip; 
     
    104121 
    105122    return watch; 
     123#else 
     124    return 0; 
     125#endif 
    106126} 
    107127 
    108128/* XXX: the following functions are local */ 
    109129 
     130#if defined HAVE_SYS_SOCKET_H 
    110131static unsigned int *create_host_list(char const *list, 
    111132                                      unsigned int *static_list) 
     
    193214    return sin.sin_addr.s_addr; 
    194215} 
    195  
     216#endif /* HAVE_SYS_SOCKET_H */ 
Note: See TracChangeset for help on using the changeset viewer.