* POSSIBILITY OF SUCH DAMAGE.
*/
+#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <tcpdump-stdinc.h>
#include <stdio.h>
-#include "netdissect.h"
#include "interface.h"
#define ASCII_LINELENGTH 300
(HEXDUMP_HEXSTUFF_PER_SHORT * HEXDUMP_SHORTS_PER_LINE)
void
-ascii_print(register const u_char *cp, register u_int length)
+ascii_print(netdissect_options *ndo,
+ const u_char *cp, u_int length)
{
- register int s;
+ register u_char s;
- putchar('\n');
+ ND_PRINT((ndo, "\n"));
while (length > 0) {
s = *cp++;
length--;
* In the middle of a line, just print a '.'.
*/
if (length > 1 && *cp != '\n')
- putchar('.');
+ ND_PRINT((ndo, "."));
} else {
if (!ND_ISGRAPH(s) &&
(s != '\t' && s != ' ' && s != '\n'))
- putchar('.');
+ ND_PRINT((ndo, "."));
else
- putchar(s);
+ ND_PRINT((ndo, "%c", s));
}
}
}
i = 0;
while (--nshorts >= 0) {
if ((i++ % 8) == 0) {
- (void)ND_PRINT((ndo,"%s0x%04x: ", ident, oset));
- oset += HEXDUMP_BYTES_PER_LINE;
+ ND_PRINT((ndo,"%s0x%04x: ", ident, oset));
+ oset += HEXDUMP_BYTES_PER_LINE;
}
s = *cp++;
- (void)ND_PRINT((ndo," %02x%02x", s, *cp++));
+ ND_PRINT((ndo," %02x%02x", s, *cp++));
}
if (length & 1) {
if ((i % 8) == 0)
- (void)ND_PRINT((ndo,"%s0x%04x: ", ident, oset));
- (void)ND_PRINT((ndo," %02x", *cp));
+ ND_PRINT((ndo,"%s0x%04x: ", ident, oset));
+ ND_PRINT((ndo," %02x", *cp));
}
}