"@(#) 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.12 2004-06-15 00:01:52 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/tcpdump.c,v 1.216.2.13 2004-09-04 00:04:49 guy Exp $ (LBL)";
#endif
/*
break;
case 'X':
- ++xflag;
++Xflag;
break;
/*
* Include the link-layer header.
*/
- default_print(sp, h->caplen);
+ hex_print("\n\t", sp, h->caplen);
} else {
/*
* Don't include the link-layer header - and if
* print nothing.
*/
if (h->caplen > hdrlen)
- default_print(sp + hdrlen,
+ hex_print("\n\t", sp + hdrlen,
+ h->caplen - hdrlen);
+ }
+ } else if (Xflag) {
+ /*
+ * Print the raw packet data.
+ */
+ if (Xflag > 1) {
+ /*
+ * Include the link-layer header.
+ */
+ ascii_print("\n\t", sp, h->caplen);
+ } else {
+ /*
+ * Don't include the link-layer header - and if
+ * we have nothing past the link-layer header,
+ * print nothing.
+ */
+ if (h->caplen > hdrlen)
+ ascii_print("\n\t", sp + hdrlen,
h->caplen - hdrlen);
}
}
void
default_print(register const u_char *bp, register u_int length)
{
- ascii_print("\n\t", bp, length); /* pass on lf and identation string */
+ ascii_print("\n\t", bp, length); /* pass on lf and identation string */
}
#ifdef SIGINFO