From: hannes Date: Mon, 29 Dec 2003 10:30:40 +0000 (+0000) Subject: pass an identation string to the ascii printer X-Git-Tag: tcpdump-3.9.1~514 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/f910e26813207a9c42fd5e59a0f29cd68afcd95d pass an identation string to the ascii printer --- diff --git a/interface.h b/interface.h index 840311a7..284f0bbd 100644 --- a/interface.h +++ b/interface.h @@ -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 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); diff --git a/print-ascii.c b/print-ascii.c index fc6c6361..34640b4f 100644 --- a/print-ascii.c +++ b/print-ascii.c @@ -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 #include @@ -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 */ + +