From: guy Date: Tue, 18 Nov 2003 08:53:40 +0000 (+0000) Subject: In MSVC++'s C library, _IOLBF is the same as _IOFBF; use _IONBF instead. X-Git-Tag: tcpdump-3.8.1~34 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/b60551ea3451726d7f4c685415d281bc7c115d3a In MSVC++'s C library, _IOLBF is the same as _IOFBF; use _IONBF instead. Fix the timeout in the "pcap_open_live()" call - I accidentally checked in a larger value I was using while testing pcap_breakloop(). --- diff --git a/tcpdump.c b/tcpdump.c index 5ceeec56..12160045 100644 --- 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.216.2.2 2003-11-16 08:51:57 guy Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/tcpdump/tcpdump.c,v 1.216.2.3 2003-11-18 08:53:40 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)