]> The Tcpdump Group git mirrors - libpcap/commitdiff
The official #define for 32-bit and 64-bit Windows is _WIN32.
authorGuy Harris <[email protected]>
Mon, 31 Aug 2015 21:39:23 +0000 (14:39 -0700)
committerGuy Harris <[email protected]>
Mon, 31 Aug 2015 21:39:23 +0000 (14:39 -0700)
It's _WIN32, with a leading underscore, not WIN32.  See, for example:

https://sourceforge.net/p/predef/wiki/OperatingSystems/

and

https://msdn.microsoft.com/en-us/library/b0084kay.aspx

*Some* environments may also define WIN32, but we shouldn't depend on
that.

24 files changed:
Win32/Include/arpa/nameser.h
Win32/Include/net/netdb.h
Win32/Src/gai_strerror.c
Win32/Src/getaddrinfo.c
Win32/Src/getopt.c
Win32/Src/inet_pton.c
bpf/net/bpf_filter.c
bpf_image.c
etherent.c
gencode.c
grammar.y
inet.c
nametoaddr.c
optimize.c
pcap-common.c
pcap-int.h
pcap-win32.c
pcap.c
pcap/pcap.h
savefile.c
scanner.l
sf-pcap-ng.c
sf-pcap.c
tests/filtertest.c

index b20dc1e3f15222e580fb649e374ac8cb29764a7c..c70a655e6c2cfddb2d4c35feea537265c428a8cc 100644 (file)
@@ -61,7 +61,7 @@
 #ifndef _NAMESER_H_
 #define        _NAMESER_H_
 
-#ifndef WIN32
+#ifndef _WIN32
 #include <sys/param.h>
 #if (!defined(BSD)) || (BSD < 199306)
 # include <sys/bitypes.h>
index f7685d25071466e10b4619abcf508614804c740b..49fcd509e99705db8ad07271d6fab7fdb0776274 100644 (file)
@@ -81,7 +81,7 @@ struct rpcent {
        int     r_number;       /* rpc program number */
 };
 
-#ifndef WIN32
+#ifndef _WIN32
 #if defined(_POSIX_THREAD_SAFE_FUNCTIONS) || defined(_REENTRANT)
 
 #define __NETDB_MAXALIASES     35
index a36c35d8f5ea7d826b12d01fe6b27f47956445b5..d1e70f84a9dc54cefd5ee277f31543668dd5d8b9 100644 (file)
@@ -34,7 +34,7 @@ __FBSDID("$FreeBSD: /repoman/r/ncvs/src/lib/libc/net/gai_strerror.c,v 1.1 2005/0
 
 */
 
-#ifdef WIN32
+#ifdef _WIN32
 
 #include <ws2tcpip.h>
 
@@ -80,4 +80,4 @@ WSAAPI gai_strerrorA(int ecode)
        return "Unknown error";
 }
 
-#endif /* gai_strerror */
\ No newline at end of file
+#endif /* gai_strerror */
index d3ebda085f632da0e3f664665b146f8d7deff65e..c894d3f7c665880e560c02bd65257593105adbf5 100644 (file)
@@ -85,7 +85,7 @@
 
 #ifdef NEED_ADDRINFO_H
 #include "addrinfo.h"
-#ifdef WIN32
+#ifdef _WIN32
 #include "ip6_misc.h"
 #endif
 #endif
index 03c2086efdcb9b48d659359590e3ef858800ca12..f5e62daa4cccf380ae1b1e06f3d96cb5b0b653c1 100644 (file)
@@ -59,7 +59,7 @@ getopt(nargc, nargv, ostr)
        char * const *nargv;
        const char *ostr;
 {
-#ifdef WIN32
+#ifdef _WIN32
        char *__progname="windump";
 #else
        extern char *__progname;
index 7fe3813a0c8b698c407a32e72e25362a9977e85b..462b9baf842ce2fc9b4c95ebf558f3006cbd1d33 100644 (file)
@@ -38,7 +38,7 @@
 
 #include <errno.h>
 
-#ifdef WIN32
+#ifdef _WIN32
 #ifndef EAFNOSUPPORT
 #define        EAFNOSUPPORT    97      /* not present in errno.h provided with VC */
 #endif
index 6cf6f12e37f5840809f21cbb42afda5766f72736..9abbd5406d2c8a25fd287acf78fdcb6f9134f8e1 100644 (file)
 #include "config.h"
 #endif
 
-#ifdef WIN32
+#ifdef _WIN32
 
 #include <pcap-stdinc.h>
 
-#else /* WIN32 */
+#else /* _WIN32 */
 
 #if HAVE_INTTYPES_H
 #include <inttypes.h>
@@ -73,7 +73,7 @@
 # define       MLEN(m) ((m)->m_len)
 #endif /* defined(__hpux) || SOLARIS */
 
-#endif /* WIN32 */
+#endif /* _WIN32 */
 
 #include <pcap/bpf.h>
 
@@ -99,7 +99,7 @@
 #endif
 
 #ifndef LBL_ALIGN
-#ifndef WIN32
+#ifndef _WIN32
 #include <netinet/in.h>
 #endif
 
index 3e9a23f51b4cd871e873085f18f8307372989274..a7beb1f4ee46b0d11a622780ab82965d62692ef9 100644 (file)
@@ -23,9 +23,9 @@
 #include "config.h"
 #endif
 
-#ifdef WIN32
+#ifdef _WIN32
 #include <pcap-stdinc.h>
-#else /* WIN32 */
+#else /* _WIN32 */
 #if HAVE_INTTYPES_H
 #include <inttypes.h>
 #elif HAVE_STDINT_H
@@ -35,7 +35,7 @@
 #include <sys/bitypes.h>
 #endif
 #include <sys/types.h>
-#endif /* WIN32 */
+#endif /* _WIN32 */
 
 #include <stdio.h>
 #include <string.h>
index 707fd9d148b77eff2b80dc928c6987c2aa015b4a..5cfd1b4c3bbb689b9179cfbb474d5cd5ba1934e8 100644 (file)
@@ -23,9 +23,9 @@
 #include "config.h"
 #endif
 
-#ifdef WIN32
+#ifdef _WIN32
 #include <pcap-stdinc.h>
-#else /* WIN32 */
+#else /* _WIN32 */
 #if HAVE_INTTYPES_H
 #include <inttypes.h>
 #elif HAVE_STDINT_H
@@ -35,7 +35,7 @@
 #include <sys/bitypes.h>
 #endif
 #include <sys/types.h>
-#endif /* WIN32 */
+#endif /* _WIN32 */
 
 #include <ctype.h>
 #include <memory.h>
index 552c40a134bed9a42521fcc0905d328901359353..2caf66edc353b483a61c87d959fec1fe1396c5e2 100644 (file)
--- a/gencode.c
+++ b/gencode.c
@@ -24,9 +24,9 @@
 #include "config.h"
 #endif
 
-#ifdef WIN32
+#ifdef _WIN32
 #include <pcap-stdinc.h>
-#else /* WIN32 */
+#else /* _WIN32 */
 #if HAVE_INTTYPES_H
 #include <inttypes.h>
 #elif HAVE_STDINT_H
@@ -37,7 +37,7 @@
 #endif
 #include <sys/types.h>
 #include <sys/socket.h>
-#endif /* WIN32 */
+#endif /* _WIN32 */
 
 /*
  * XXX - why was this included even on UNIX?
@@ -46,7 +46,7 @@
 #include "ip6_misc.h"
 #endif
 
-#ifndef WIN32
+#ifndef _WIN32
 
 #ifdef __NetBSD__
 #include <sys/param.h>
@@ -55,7 +55,7 @@
 #include <netinet/in.h>
 #include <arpa/inet.h>
 
-#endif /* WIN32 */
+#endif /* _WIN32 */
 
 #include <stdlib.h>
 #include <string.h>
@@ -95,9 +95,9 @@
 #define offsetof(s, e) ((size_t)&((s *)0)->e)
 #endif
 #ifdef INET6
-#ifndef WIN32
+#ifndef _WIN32
 #include <netdb.h>     /* for "struct addrinfo" */
-#endif /* WIN32 */
+#endif /* _WIN32 */
 #endif /*INET6*/
 #include <pcap/namedb.h>
 
@@ -136,7 +136,7 @@ static jmp_buf top_ctx;
 static pcap_t *bpf_pcap;
 
 /* Hack for handling VLAN and MPLS stacks. */
-#ifdef WIN32
+#ifdef _WIN32
 static u_int   label_stack_depth = (u_int)-1, vlan_stack_depth = (u_int)-1;
 #else
 static u_int   label_stack_depth = -1U, vlan_stack_depth = -1U;
@@ -440,7 +440,7 @@ pcap_compile(pcap_t *p, struct bpf_program *program,
         * UN*X, if the platform supports pthreads?  If that requires
         * a separate -lpthread, we might not want to do that.
         */
-#ifdef WIN32
+#ifdef _WIN32
        extern int wsockinit (void);
        static int done = 0;
 
@@ -515,7 +515,7 @@ pcap_compile(pcap_t *p, struct bpf_program *program,
 
 quit:
 
-#ifdef WIN32
+#ifdef _WIN32
        LeaveCriticalSection(&g_PcapCompileCriticalSection);
 #endif
 
index 995a514e3edb2c0732f87e0503edb2b864e14b11..700508b40359855b1b996522e5eac7b3c1278aba 100644 (file)
--- a/grammar.y
+++ b/grammar.y
 #include "config.h"
 #endif
 
-#ifdef WIN32
+#ifdef _WIN32
 #include <pcap-stdinc.h>
-#else /* WIN32 */
+#else /* _WIN32 */
 #include <sys/types.h>
 #include <sys/socket.h>
-#endif /* WIN32 */
+#endif /* _WIN32 */
 
 #include <stdlib.h>
 
-#ifndef WIN32
+#ifndef _WIN32
 #if __STDC__
 struct mbuf;
 struct rtentry;
@@ -42,7 +42,7 @@ struct rtentry;
 
 #include <netinet/in.h>
 #include <arpa/inet.h>
-#endif /* WIN32 */
+#endif /* _WIN32 */
 
 #include <stdio.h>
 
diff --git a/inet.c b/inet.c
index e7d2104e3310e8fa4ee8302919a54865a6acbc1b..7cd87ad19d0f75baee7c2eaf853249af17a03514 100644 (file)
--- a/inet.c
+++ b/inet.c
@@ -36,9 +36,9 @@
 #include "config.h"
 #endif
 
-#ifdef WIN32
+#ifdef _WIN32
 #include <pcap-stdinc.h>
-#else /* WIN32 */
+#else /* _WIN32 */
 
 #include <sys/param.h>
 #ifndef MSDOS
@@ -54,7 +54,7 @@ struct mbuf;          /* Squelch compiler warnings on some platforms for */
 struct rtentry;                /* declarations in <net/if.h> */
 #include <net/if.h>
 #include <netinet/in.h>
-#endif /* WIN32 */
+#endif /* _WIN32 */
 
 #include <ctype.h>
 #include <errno.h>
@@ -62,9 +62,9 @@ struct rtentry;               /* declarations in <net/if.h> */
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#if !defined(WIN32) && !defined(__BORLANDC__)
+#if !defined(_WIN32) && !defined(__BORLANDC__)
 #include <unistd.h>
-#endif /* !WIN32 && !__BORLANDC__ */
+#endif /* !_WIN32 && !__BORLANDC__ */
 #ifdef HAVE_LIMITS_H
 #include <limits.h>
 #else
@@ -828,7 +828,7 @@ pcap_freealldevs(pcap_if_t *alldevs)
        }
 }
 
-#if !defined(WIN32) && !defined(MSDOS)
+#if !defined(_WIN32) && !defined(MSDOS)
 
 /*
  * Return the name of a network interface attached to the system, or NULL
@@ -970,7 +970,7 @@ pcap_lookupnet(device, netp, maskp, errbuf)
        return (0);
 }
 
-#elif defined(WIN32)
+#elif defined(_WIN32)
 
 /*
  * Return the name of a network interface attached to the system, or NULL
@@ -1098,4 +1098,4 @@ pcap_lookupnet(device, netp, maskp, errbuf)
        return (0);
 }
 
-#endif /* !WIN32 && !MSDOS */
+#endif /* !_WIN32 && !MSDOS */
index e6483a358d09f075898f6687369df18ec577042c..eb12361514c9e9e109cad867835c51615b63c6c5 100644 (file)
 #include <netdnet/dnetdb.h>
 #endif
 
-#ifdef WIN32
+#ifdef _WIN32
 #include <pcap-stdinc.h>
 
-#else /* WIN32 */
+#else /* _WIN32 */
 
 #include <sys/param.h>
 #include <sys/types.h>                         /* concession to AIX */
@@ -42,9 +42,9 @@
 #include <sys/time.h>
 
 #include <netinet/in.h>
-#endif /* WIN32 */
+#endif /* _WIN32 */
 
-#ifndef WIN32
+#ifndef _WIN32
 #ifdef HAVE_ETHER_HOSTTON
 /*
  * XXX - do we need any of this if <netinet/if_ether.h> doesn't declare
@@ -62,7 +62,7 @@ struct rtentry;               /* declarations in <net/if.h> */
 #endif /* HAVE_ETHER_HOSTTON */
 #include <arpa/inet.h>
 #include <netdb.h>
-#endif /* WIN32 */
+#endif /* _WIN32 */
 
 #include <ctype.h>
 #include <errno.h>
@@ -140,7 +140,7 @@ pcap_nametoaddrinfo(const char *name)
 bpf_u_int32
 pcap_nametonetaddr(const char *name)
 {
-#ifndef WIN32
+#ifndef _WIN32
        struct netent *np;
 
        if ((np = getnetbyname(name)) != NULL)
index ada20197647d5e2f114d469fa91d008bf90dd9f3..dba8edfd955e7b594ca8947b6a3b39147948f8b2 100644 (file)
@@ -25,9 +25,9 @@
 #include "config.h"
 #endif
 
-#ifdef WIN32
+#ifdef _WIN32
 #include <pcap-stdinc.h>
-#else /* WIN32 */
+#else /* _WIN32 */
 #if HAVE_INTTYPES_H
 #include <inttypes.h>
 #elif HAVE_STDINT_H
@@ -37,7 +37,7 @@
 #include <sys/bitypes.h>
 #endif
 #include <sys/types.h>
-#endif /* WIN32 */
+#endif /* _WIN32 */
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -63,7 +63,7 @@ extern int _w32_ffs (int mask);
 #define ffs _w32_ffs
 #endif
 
-#if defined(WIN32) && defined (_MSC_VER)
+#if defined(_WIN32) && defined (_MSC_VER)
 int ffs(int mask);
 #endif
 
index 4db49688547a4a2ce02d52666b0ee132dee3c9ca..b4a25028aa8f61e0f8038633fe736b2adf3fe2a0 100644 (file)
@@ -25,9 +25,9 @@
 #include "config.h"
 #endif
 
-#ifdef WIN32
+#ifdef _WIN32
 #include <pcap-stdinc.h>
-#else /* WIN32 */
+#else /* _WIN32 */
 #if HAVE_INTTYPES_H
 #include <inttypes.h>
 #elif HAVE_STDINT_H
@@ -37,7 +37,7 @@
 #include <sys/bitypes.h>
 #endif
 #include <sys/types.h>
-#endif /* WIN32 */
+#endif /* _WIN32 */
 
 #include "pcap-int.h"
 #include "pcap/usb.h"
index bae3ee95d77efc3065a4a812bf84afe51609640c..d0306b80e3b1056002e96f56b796d7a3a7775aa8 100644 (file)
 extern "C" {
 #endif
 
-#ifdef WIN32
+#ifdef _WIN32
 #include <Packet32.h>
 extern CRITICAL_SECTION g_PcapCompileCriticalSection;
-#endif /* WIN32 */
+#endif /* _WIN32 */
 
 #ifdef MSDOS
 #include <fcntl.h>
@@ -126,7 +126,7 @@ typedef int (*set_datalink_op_t)(pcap_t *, int);
 typedef int    (*getnonblock_op_t)(pcap_t *, char *);
 typedef int    (*setnonblock_op_t)(pcap_t *, int, char *);
 typedef int    (*stats_op_t)(pcap_t *, struct pcap_stat *);
-#ifdef WIN32
+#ifdef _WIN32
 typedef int    (*setbuff_op_t)(pcap_t *, int);
 typedef int    (*setmode_op_t)(pcap_t *, int);
 typedef int    (*setmintocopy_op_t)(pcap_t *, int);
@@ -149,14 +149,14 @@ struct pcap {
         */
        int (*next_packet_op)(pcap_t *, struct pcap_pkthdr *, u_char **);
 
-#ifdef WIN32
+#ifdef _WIN32
        ADAPTER *adapter;
        LPPACKET Packet;
        int nonblock;
 #else
        int fd;
        int selectable_fd;
-#endif /* WIN32 */
+#endif /* _WIN32 */
 
        /*
         * Read buffer.
@@ -240,7 +240,7 @@ struct pcap {
         */
        pcap_handler oneshot_callback;
 
-#ifdef WIN32
+#ifdef _WIN32
        /*
         * These are, at least currently, specific to the Win32 NPF
         * driver.
@@ -376,7 +376,7 @@ extern int vsnprintf (char *, size_t, const char *, va_list ap);
 /*
  * Routines that most pcap implementations can use for non-blocking mode.
  */
-#if !defined(WIN32) && !defined(MSDOS)
+#if !defined(_WIN32) && !defined(MSDOS)
 int    pcap_getnonblock_fd(pcap_t *, char *);
 int    pcap_setnonblock_fd(pcap_t *p, int, char *);
 #endif
@@ -448,7 +448,7 @@ void        sf_cleanup(pcap_t *p);
  */
 void   pcap_oneshot(u_char *, const struct pcap_pkthdr *, const u_char *);
 
-#ifdef WIN32
+#ifdef _WIN32
 char   *pcap_win32strerror(void);
 #endif
 
index 9b38f3c386e4b4756669edae2d5710db635ffd98..7457df36354a2c4537542116ba9627a579f4986d 100644 (file)
@@ -61,7 +61,7 @@ static int pcap_setnonblock_win32(pcap_t *, int, char *);
 #define        WIN32_DEFAULT_USER_BUFFER_SIZE 256000
 
 /*dimension of the buffer in the kernel driver NPF */
-#define        WIN32_DEFAULT_KERNEL_BUFFER_SIZE 1000000
+#define        _WIN32_DEFAULT_KERNEL_BUFFER_SIZE 1000000
 
 /* Equivalent to ntohs(), but a lot faster under Windows */
 #define SWAPS(_X) ((_X & 0xff) << 8) | (_X >> 8)
@@ -655,7 +655,7 @@ pcap_activate_win32(pcap_t *p)
                 * WIN32_DEFAULT_USER_BUFFER_SIZE.
                 */
                if (p->opt.buffer_size == 0)
-                       p->opt.buffer_size = WIN32_DEFAULT_KERNEL_BUFFER_SIZE;
+                       p->opt.buffer_size = _WIN32_DEFAULT_KERNEL_BUFFER_SIZE;
 
                if(PacketSetBuff(p->adapter,p->opt.buffer_size)==FALSE)
                {
diff --git a/pcap.c b/pcap.c
index 4e9c94a72bd3a5d7c66bc59e683da5ab57863c8e..7769569d601cd2cbd0d129c857ada22ff39c6506 100644 (file)
--- a/pcap.c
+++ b/pcap.c
@@ -35,9 +35,9 @@
 #include "config.h"
 #endif
 
-#ifdef WIN32
+#ifdef _WIN32
 #include <pcap-stdinc.h>
-#else /* WIN32 */
+#else /* _WIN32 */
 #if HAVE_INTTYPES_H
 #include <inttypes.h>
 #elif HAVE_STDINT_H
@@ -47,7 +47,7 @@
 #include <sys/bitypes.h>
 #endif
 #include <sys/types.h>
-#endif /* WIN32 */
+#endif /* _WIN32 */
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -115,7 +115,7 @@ pcap_not_initialized(pcap_t *pcap _U_)
        return (PCAP_ERROR_NOT_ACTIVATED);
 }
 
-#ifdef WIN32
+#ifdef _WIN32
 Adapter *
 pcap_no_adapter(pcap_t *pcap _U_)
 {
@@ -463,7 +463,7 @@ initialize_ops(pcap_t *p)
        p->getnonblock_op = (getnonblock_op_t)pcap_not_initialized;
        p->setnonblock_op = (setnonblock_op_t)pcap_not_initialized;
        p->stats_op = (stats_op_t)pcap_not_initialized;
-#ifdef WIN32
+#ifdef _WIN32
        p->setbuff_op = (setbuff_op_t)pcap_not_initialized;
        p->setmode_op = (setmode_op_t)pcap_not_initialized;
        p->setmintocopy_op = (setmintocopy_op_t)pcap_not_initialized;
@@ -509,7 +509,7 @@ pcap_alloc_pcap_t(char *ebuf, size_t size)
         */
        p = (pcap_t *)chunk;
 
-#ifndef WIN32
+#ifndef _WIN32
        p->fd = -1;     /* not opened yet */
        p->selectable_fd = -1;
 #endif
@@ -1365,7 +1365,7 @@ pcap_file(pcap_t *p)
 int
 pcap_fileno(pcap_t *p)
 {
-#ifndef WIN32
+#ifndef _WIN32
        return (p->fd);
 #else
        if (p->adapter != NULL)
@@ -1375,7 +1375,7 @@ pcap_fileno(pcap_t *p)
 #endif
 }
 
-#if !defined(WIN32) && !defined(MSDOS)
+#if !defined(_WIN32) && !defined(MSDOS)
 int
 pcap_get_selectable_fd(pcap_t *p)
 {
@@ -1419,7 +1419,7 @@ pcap_getnonblock(pcap_t *p, char *errbuf)
  * We don't look at "p->nonblock", in case somebody tweaked the FD
  * directly.
  */
-#if !defined(WIN32) && !defined(MSDOS)
+#if !defined(_WIN32) && !defined(MSDOS)
 int
 pcap_getnonblock_fd(pcap_t *p, char *errbuf)
 {
@@ -1455,7 +1455,7 @@ pcap_setnonblock(pcap_t *p, int nonblock, char *errbuf)
        return (ret);
 }
 
-#if !defined(WIN32) && !defined(MSDOS)
+#if !defined(_WIN32) && !defined(MSDOS)
 /*
  * Set non-blocking mode, under the assumption that it's just the
  * standard POSIX non-blocking flag.  (This can be called by the
@@ -1486,7 +1486,7 @@ pcap_setnonblock_fd(pcap_t *p, int nonblock, char *errbuf)
 }
 #endif
 
-#ifdef WIN32
+#ifdef _WIN32
 /*
  * Generate a string for the last Win32-specific error (i.e. an error generated when
  * calling a Win32 API).
@@ -1635,7 +1635,7 @@ pcap_stats_dead(pcap_t *p, struct pcap_stat *ps _U_)
        return (-1);
 }
 
-#ifdef WIN32
+#ifdef _WIN32
 int
 pcap_setbuff(pcap_t *p, int dim)
 {
@@ -1797,7 +1797,7 @@ pcap_cleanup_live_common(pcap_t *p)
                p->tstamp_precision_count = 0;
        }
        pcap_freecode(&p->fcode);
-#if !defined(WIN32) && !defined(MSDOS)
+#if !defined(_WIN32) && !defined(MSDOS)
        if (p->fd >= 0) {
                close(p->fd);
                p->fd = -1;
@@ -1834,7 +1834,7 @@ pcap_open_dead_with_tstamp_precision(int linktype, int snaplen, u_int precision)
        p->linktype = linktype;
        p->opt.tstamp_precision = precision;
        p->stats_op = pcap_stats_dead;
-#ifdef WIN32
+#ifdef _WIN32
        p->setbuff_op = pcap_setbuff_dead;
        p->setmode_op = pcap_setmode_dead;
        p->setmintocopy_op = pcap_setmintocopy_dead;
@@ -1926,7 +1926,7 @@ pcap_offline_filter(const struct bpf_program *fp, const struct pcap_pkthdr *h,
 static const char pcap_version_string[] = "libpcap version 1.x.y";
 #endif
 
-#ifdef WIN32
+#ifdef _WIN32
 /*
  * XXX - it'd be nice if we could somehow generate the WinPcap and libpcap
  * version numbers when building WinPcap.  (It'd be nice to do so for
index c9fab4c11890dde6de5bd07a3af75f2e9d586bf2..045e4872db7c902a03917f9b9e4fb3a9240de60b 100644 (file)
@@ -35,7 +35,7 @@
 #ifndef lib_pcap_pcap_h
 #define lib_pcap_pcap_h
 
-#if defined(WIN32)
+#if defined(_WIN32)
   #include <pcap-stdinc.h>
 #elif defined(MSDOS)
   #include <sys/types.h>
@@ -43,7 +43,7 @@
 #else /* UN*X */
   #include <sys/types.h>
   #include <sys/time.h>
-#endif /* WIN32/MSDOS/UN*X */
+#endif /* _WIN32/MSDOS/UN*X */
 
 #ifndef PCAP_DONT_INCLUDE_PCAP_BPF_H
 #include <pcap/bpf.h>
@@ -170,9 +170,9 @@ struct pcap_stat {
        u_int ps_recv;          /* number of packets received */
        u_int ps_drop;          /* number of packets dropped */
        u_int ps_ifdrop;        /* drops by interface -- only supported on some platforms */
-#ifdef WIN32
+#ifdef _WIN32
        u_int bs_capt;          /* number of packets that reach the application */
-#endif /* WIN32 */
+#endif /* _WIN32 */
 };
 
 #ifdef MSDOS
@@ -351,7 +351,7 @@ pcap_t      *pcap_open_dead(int, int);
 pcap_t *pcap_open_dead_with_tstamp_precision(int, int, u_int);
 pcap_t *pcap_open_offline_with_tstamp_precision(const char *, u_int, char *);
 pcap_t *pcap_open_offline(const char *, char *);
-#if defined(WIN32)
+#if defined(_WIN32)
 pcap_t  *pcap_hopen_offline_with_tstamp_precision(intptr_t, u_int, char *);
 pcap_t  *pcap_hopen_offline(intptr_t, char *);
 #if !defined(LIBPCAP_EXPORTS)
@@ -363,10 +363,10 @@ pcap_t  *pcap_hopen_offline(intptr_t, char *);
 static pcap_t *pcap_fopen_offline_with_tstamp_precision(FILE *, u_int, char *);
 static pcap_t *pcap_fopen_offline(FILE *, char *);
 #endif
-#else /*WIN32*/
+#else /*_WIN32*/
 pcap_t *pcap_fopen_offline_with_tstamp_precision(FILE *, u_int, char *);
 pcap_t *pcap_fopen_offline(FILE *, char *);
-#endif /*WIN32*/
+#endif /*_WIN32*/
 
 void   pcap_close(pcap_t *);
 int    pcap_loop(pcap_t *, int, pcap_handler, u_char *);
@@ -438,7 +438,7 @@ int bpf_validate(const struct bpf_insn *f, int len);
 char   *bpf_image(const struct bpf_insn *, int);
 void   bpf_dump(const struct bpf_program *, int);
 
-#if defined(WIN32)
+#if defined(_WIN32)
 
 /*
  * Win32 definitions
@@ -476,7 +476,7 @@ u_long pcap_mac_packets (void);
 
 int    pcap_get_selectable_fd(pcap_t *);
 
-#endif /* WIN32/MSDOS/UN*X */
+#endif /* _WIN32/MSDOS/UN*X */
 
 #ifdef __cplusplus
 }
index 783ec45bb0497be0b275337b9307311da55585ab..e241b6bad44afb7a11e73370859dc2e821aa6d89 100644 (file)
@@ -32,9 +32,9 @@
 #include "config.h"
 #endif
 
-#ifdef WIN32
+#ifdef _WIN32
 #include <pcap-stdinc.h>
-#else /* WIN32 */
+#else /* _WIN32 */
 #if HAVE_INTTYPES_H
 #include <inttypes.h>
 #elif HAVE_STDINT_H
@@ -44,7 +44,7 @@
 #include <sys/bitypes.h>
 #endif
 #include <sys/types.h>
-#endif /* WIN32 */
+#endif /* _WIN32 */
 
 #include <errno.h>
 #include <memory.h>
@@ -65,7 +65,7 @@
 /*
  * Setting O_BINARY on DOS/Windows is a bit tricky
  */
-#if defined(WIN32)
+#if defined(_WIN32)
   #define SET_BINMODE(f)  _setmode(_fileno(f), _O_BINARY)
 #elif defined(MSDOS)
   #if defined(__HIGHC__)
@@ -109,7 +109,7 @@ sf_stats(pcap_t *p, struct pcap_stat *ps)
        return (-1);
 }
 
-#ifdef WIN32
+#ifdef _WIN32
 static int
 sf_setbuff(pcap_t *p, int dim)
 {
@@ -175,7 +175,7 @@ pcap_open_offline_with_tstamp_precision(const char *fname, u_int precision,
        if (fname[0] == '-' && fname[1] == '\0')
        {
                fp = stdin;
-#if defined(WIN32) || defined(MSDOS)
+#if defined(_WIN32) || defined(MSDOS)
                /*
                 * We're reading from the standard input, so put it in binary
                 * mode, as savefiles are binary files.
@@ -184,7 +184,7 @@ pcap_open_offline_with_tstamp_precision(const char *fname, u_int precision,
 #endif
        }
        else {
-#if !defined(WIN32) && !defined(MSDOS)
+#if !defined(_WIN32) && !defined(MSDOS)
                fp = fopen(fname, "r");
 #else
                fp = fopen(fname, "rb");
@@ -210,7 +210,7 @@ pcap_open_offline(const char *fname, char *errbuf)
            PCAP_TSTAMP_PRECISION_MICRO, errbuf));
 }
 
-#ifdef WIN32
+#ifdef _WIN32
 pcap_t* pcap_hopen_offline_with_tstamp_precision(intptr_t osfd, u_int precision,
     char *errbuf)
 {
@@ -249,7 +249,7 @@ static pcap_t *(*check_headers[])(bpf_u_int32, FILE *, u_int, char *, int *) = {
 
 #define        N_FILE_TYPES    (sizeof check_headers / sizeof check_headers[0])
 
-#ifdef WIN32
+#ifdef _WIN32
 static
 #endif
 pcap_t *
@@ -313,7 +313,7 @@ found:
        /* Padding only needed for live capture fcode */
        p->fddipad = 0;
 
-#if !defined(WIN32) && !defined(MSDOS)
+#if !defined(_WIN32) && !defined(MSDOS)
        /*
         * You can do "select()" and "poll()" on plain files on most
         * platforms, and should be able to do so on pipes.
@@ -332,7 +332,7 @@ found:
        p->getnonblock_op = sf_getnonblock;
        p->setnonblock_op = sf_setnonblock;
        p->stats_op = sf_stats;
-#ifdef WIN32
+#ifdef _WIN32
        p->setbuff_op = sf_setbuff;
        p->setmode_op = sf_setmode;
        p->setmintocopy_op = sf_setmintocopy;
@@ -354,7 +354,7 @@ found:
        return (p);
 }
 
-#ifdef WIN32
+#ifdef _WIN32
 static
 #endif
 pcap_t *
index 72a83f7fa2562095352cbfc6529b9df79b11e476..90c76b833c5a13bdc626a8df3e44b30e9c2978f0 100644 (file)
--- a/scanner.l
+++ b/scanner.l
@@ -20,9 +20,9 @@
  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  */
 
-#ifdef WIN32
+#ifdef _WIN32
 #include <pcap-stdinc.h>
-#else /* WIN32 */
+#else /* _WIN32 */
 #if HAVE_INTTYPES_H
 #include <inttypes.h>
 #elif HAVE_STDINT_H
@@ -32,7 +32,7 @@
 #include <sys/bitypes.h>
 #endif
 #include <sys/types.h>
-#endif /* WIN32 */
+#endif /* _WIN32 */
 
 #include <ctype.h>
 #include <string.h>
 
 #include "gencode.h"
 #ifdef INET6
-#ifdef WIN32
+#ifdef _WIN32
 #include <pcap-stdinc.h>
 
 #ifdef __MINGW32__
 #include "ip6_misc.h"
 #endif
-#else /* WIN32 */
+#else /* _WIN32 */
 #include <sys/socket.h>        /* for "struct sockaddr" in "struct addrinfo" */
 #include <netdb.h>     /* for "struct addrinfo" */
-#endif /* WIN32 */
+#endif /* _WIN32 */
 
 /* Workaround for AIX 4.3 */
 #if !defined(AI_NUMERICHOST)
index 1acb06c773a8e0c25c22bbc637bd9052df9e629f..21f48278cc9452ebad6593d64685d063b85a4094 100644 (file)
@@ -30,9 +30,9 @@ static const char rcsid[] _U_ =
 #include "config.h"
 #endif
 
-#ifdef WIN32
+#ifdef _WIN32
 #include <pcap-stdinc.h>
-#else /* WIN32 */
+#else /* _WIN32 */
 #if HAVE_INTTYPES_H
 #include <inttypes.h>
 #elif HAVE_STDINT_H
@@ -42,7 +42,7 @@ static const char rcsid[] _U_ =
 #include <sys/bitypes.h>
 #endif
 #include <sys/types.h>
-#endif /* WIN32 */
+#endif /* _WIN32 */
 
 #include <errno.h>
 #include <memory.h>
index 671e40cb984c014093a744569177372230d0cb2f..86b9aec69639799733733c7f624a194f256b0e4a 100644 (file)
--- a/sf-pcap.c
+++ b/sf-pcap.c
@@ -37,9 +37,9 @@ static const char rcsid[] _U_ =
 #include "config.h"
 #endif
 
-#ifdef WIN32
+#ifdef _WIN32
 #include <pcap-stdinc.h>
-#else /* WIN32 */
+#else /* _WIN32 */
 #if HAVE_INTTYPES_H
 #include <inttypes.h>
 #elif HAVE_STDINT_H
@@ -49,7 +49,7 @@ static const char rcsid[] _U_ =
 #include <sys/bitypes.h>
 #endif
 #include <sys/types.h>
-#endif /* WIN32 */
+#endif /* _WIN32 */
 
 #include <errno.h>
 #include <memory.h>
@@ -70,7 +70,7 @@ static const char rcsid[] _U_ =
 /*
  * Setting O_BINARY on DOS/Windows is a bit tricky
  */
-#if defined(WIN32)
+#if defined(_WIN32)
   #define SET_BINMODE(f)  _setmode(_fileno(f), _O_BINARY)
 #elif defined(MSDOS)
   #if defined(__HIGHC__)
@@ -635,7 +635,7 @@ static pcap_dumper_t *
 pcap_setup_dump(pcap_t *p, int linktype, FILE *f, const char *fname)
 {
 
-#if defined(WIN32) || defined(MSDOS)
+#if defined(_WIN32) || defined(MSDOS)
        /*
         * If we're writing to the standard output, put it in binary
         * mode, as savefiles are binary files.
@@ -690,7 +690,7 @@ pcap_dump_open(pcap_t *p, const char *fname)
                f = stdout;
                fname = "standard output";
        } else {
-#if !defined(WIN32) && !defined(MSDOS)
+#if !defined(_WIN32) && !defined(MSDOS)
                f = fopen(fname, "w");
 #else
                f = fopen(fname, "wb");
@@ -742,7 +742,7 @@ pcap_dump_open_append(pcap_t *p, const char *fname)
        if (fname[0] == '-' && fname[1] == '\0')
                return (pcap_setup_dump(p, linktype, stdout, "standard output"));
 
-#if !defined(WIN32) && !defined(MSDOS)
+#if !defined(_WIN32) && !defined(MSDOS)
        f = fopen(fname, "r+");
 #else
        f = fopen(fname, "rb+");
@@ -771,7 +771,7 @@ pcap_dump_open_append(pcap_t *p, const char *fname)
                }
        }
 
-#if defined(WIN32) || defined(MSDOS)
+#if defined(_WIN32) || defined(MSDOS)
        /*
         * We turn off buffering.
         * XXX - why?  And why not on the standard output?
index e45db21eabbfd8f78806ac3e7b3bd39e19bf7d25..a7e57389485fe04e7f7b6efef6c3ebd68d74ed0e 100644 (file)
@@ -194,9 +194,9 @@ main(int argc, char **argv)
        pcap_t *pd;
        struct bpf_program fcode;
 
-#ifdef WIN32
+#ifdef _WIN32
        if(wsockinit() != 0) return 1;
-#endif /* WIN32 */
+#endif /* _WIN32 */
 
 #ifndef BDEBUG
        dflag = 1;