"@(#) 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.220 2003-11-18 23:09:43 guy Exp $ (LBL)";
#endif
/*
while (--n_dlts >= 0) {
dlt_name = pcap_datalink_val_to_name(dlts[n_dlts]);
if (dlt_name != NULL) {
- (void) fprintf(stderr, " %s", dlt_name);
+ (void) fprintf(stderr, " %s (%s)", dlt_name,
+ pcap_datalink_val_to_description(dlts[n_dlts]));
/*
* OK, does tcpdump handle that type?
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':
error("%s", ebuf);
dlt = pcap_datalink(pd);
dlt_name = pcap_datalink_val_to_name(dlt);
- if (dlt_name == NULL)
- dlt_name = "???";
- printf("reading from file %s, link-type %u (%s)\n",
- RFileName, dlt, dlt_name);
+ if (dlt_name == NULL) {
+ printf("reading from file %s, link-type %u\n",
+ RFileName, dlt);
+ } else {
+ printf("reading from file %s, link-type %s (%s)\n",
+ RFileName, dlt_name,
+ pcap_datalink_val_to_description(dlt));
+ }
localnet = 0;
netmask = 0;
if (fflag != 0)
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)
(void)fprintf(stderr, "%s: ", program_name);
dlt = pcap_datalink(pd);
dlt_name = pcap_datalink_val_to_name(dlt);
- if (dlt_name == NULL)
- dlt_name = "???";
- (void)fprintf(stderr, "listening on %s, link-type %u (%s), capture size %u bytes\n",
- device, dlt, dlt_name, snaplen);
+ if (dlt_name == NULL) {
+ (void)fprintf(stderr, "listening on %s, link-type %u, capture size %u bytes\n",
+ device, dlt, snaplen);
+ } else {
+ (void)fprintf(stderr, "listening on %s, link-type %s (%s), capture size %u bytes\n",
+ device, dlt_name,
+ pcap_datalink_val_to_description(dlt), snaplen);
+ }
(void)fflush(stderr);
}
#endif /* WIN32 */