]> The Tcpdump Group git mirrors - tcpdump/commitdiff
In MSVC++'s C library, _IOLBF is the same as _IOFBF; use _IONBF instead.
authorguy <guy>
Tue, 18 Nov 2003 08:53:19 +0000 (08:53 +0000)
committerguy <guy>
Tue, 18 Nov 2003 08:53:19 +0000 (08:53 +0000)
Fix the timeout in the "pcap_open_live()" call - I accidentally checked
in a larger value I was using while testing pcap_breakloop().

tcpdump.c

index 06160f7f57dcad16177f4386ac3bd75698968f24..a8b2fcae18a1a793359fb5806469972a0788aece 100644 (file)
--- a/tcpdump.c
+++ b/tcpdump.c
@@ -30,7 +30,7 @@ static const char copyright[] _U_ =
     "@(#) Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 2000\n\
 The Regents of the University of California.  All rights reserved.\n";
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/tcpdump.c,v 1.218 2003-11-16 09:36:44 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/tcpdump.c,v 1.219 2003-11-18 08:53:19 guy Exp $ (LBL)";
 #endif
 
 /*
@@ -454,11 +454,24 @@ main(int argc, char **argv)
                        break;
 
                case 'l':
+#ifdef WIN32
+                       /*
+                        * _IOLBF is the same as _IOFBF in Microsoft's C
+                        * libraries; the only alternative they offer
+                        * is _IONBF.
+                        *
+                        * XXX - this should really be checking for MSVC++,
+                        * not WIN32, if, for example, MinGW has its own
+                        * C library that is more UNIX-compatible.
+                        */
+                       setvbuf(stdout, NULL, _IONBF, 0);
+#else /* WIN32 */
 #ifdef HAVE_SETLINEBUF
                        setlinebuf(stdout);
 #else
                        setvbuf(stdout, NULL, _IOLBF, 0);
 #endif
+#endif /* WIN32 */
                        break;
 
                case 'n':
@@ -651,7 +664,7 @@ main(int argc, char **argv)
                fflush(stderr); 
 #endif /* WIN32 */
                *ebuf = '\0';
-               pd = pcap_open_live(device, snaplen, !pflag, 10000, ebuf);
+               pd = pcap_open_live(device, snaplen, !pflag, 1000, ebuf);
                if (pd == NULL)
                        error("%s", ebuf);
                else if (*ebuf)