mirror of
https://github.com/the-tcpdump-group/tcpdump.git
synced 2024-11-23 18:14:29 +08:00
pass an identation string to the ascii printer
This commit is contained in:
parent
b02277b72c
commit
f910e26813
@ -18,7 +18,7 @@
|
||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* @(#) $Header: /tcpdump/master/tcpdump/interface.h,v 1.220 2003-11-19 01:27:54 guy Exp $ (LBL)
|
||||
* @(#) $Header: /tcpdump/master/tcpdump/interface.h,v 1.221 2003-12-29 10:30:40 hannes Exp $ (LBL)
|
||||
*/
|
||||
|
||||
#ifndef tcpdump_interface_h
|
||||
@ -191,8 +191,8 @@ extern const char *dnnum_string(u_short);
|
||||
#include <pcap.h>
|
||||
|
||||
extern int print_unknown_data(const u_char *, const char *,int);
|
||||
extern void ascii_print_with_offset(const u_char *, u_int, u_int);
|
||||
extern void ascii_print(const u_char *, u_int);
|
||||
extern void ascii_print_with_offset(const u_char *, const u_char *, u_int, u_int);
|
||||
extern void ascii_print(const u_char *, const u_char *, u_int);
|
||||
extern void hex_print_with_offset(const u_char *, u_int, u_int);
|
||||
extern void telnet_print(const u_char *, u_int);
|
||||
extern void hex_print(const u_char *, u_int);
|
||||
|
@ -42,7 +42,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-ascii.c,v 1.12 2003-11-16 09:36:12 guy Exp $";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-ascii.c,v 1.13 2003-12-29 10:30:40 hannes Exp $";
|
||||
#endif
|
||||
#include <tcpdump-stdinc.h>
|
||||
#include <stdio.h>
|
||||
@ -57,7 +57,7 @@ static const char rcsid[] _U_ =
|
||||
(HEXDUMP_HEXSTUFF_PER_SHORT * HEXDUMP_SHORTS_PER_LINE)
|
||||
|
||||
void
|
||||
ascii_print_with_offset(register const u_char *cp, register u_int length,
|
||||
ascii_print_with_offset(register const u_char *ident, register const u_char *cp, register u_int length,
|
||||
register u_int oset)
|
||||
{
|
||||
register u_int i;
|
||||
@ -93,8 +93,8 @@ ascii_print_with_offset(register const u_char *cp, register u_int length,
|
||||
if (Aflag) {
|
||||
(void)printf("%s", asciistuff);
|
||||
} else {
|
||||
(void)printf("\n0x%04x\t%-*s\t%s",
|
||||
oset, HEXDUMP_HEXSTUFF_PER_LINE,
|
||||
(void)printf("%s0x%04x:\t%-*s\t%s",
|
||||
ident, oset, HEXDUMP_HEXSTUFF_PER_LINE,
|
||||
hexstuff, asciistuff);
|
||||
}
|
||||
i = 0; hsp = hexstuff; asp = asciistuff;
|
||||
@ -116,19 +116,19 @@ ascii_print_with_offset(register const u_char *cp, register u_int length,
|
||||
if (i > 0) {
|
||||
*hsp = *asp = '\0';
|
||||
if (Aflag) {
|
||||
(void)printf("\n%s", asciistuff);
|
||||
(void)printf("%s%s", ident, asciistuff);
|
||||
} else {
|
||||
(void)printf("\n0x%04x\t%-*s\t%s",
|
||||
oset, HEXDUMP_HEXSTUFF_PER_LINE,
|
||||
(void)printf("%s0x%04x:\t%-*s\t%s",
|
||||
ident, oset, HEXDUMP_HEXSTUFF_PER_LINE,
|
||||
hexstuff, asciistuff);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ascii_print(register const u_char *cp, register u_int length)
|
||||
ascii_print(register const u_char *ident, register const u_char *cp, register u_int length)
|
||||
{
|
||||
ascii_print_with_offset(cp, length, 0);
|
||||
ascii_print_with_offset(ident, cp, length, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -181,3 +181,5 @@ main(int argc, char *argv[])
|
||||
exit(0);
|
||||
}
|
||||
#endif /* MAIN */
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user