summaryrefslogtreecommitdiff
path: root/print-ascii.c
diff options
context:
space:
mode:
authorDenis Ovsienko <infrastation@yandex.ru>2014-04-03 16:02:07 +0400
committerDenis Ovsienko <infrastation@yandex.ru>2014-04-03 17:41:02 +0400
commitf274a23dc1767eca8f4c433f6bd11ac5dbf4f31e (patch)
tree6d95e38d29354e84c9527ac6dc40c472fc9fb420 /print-ascii.c
parent302c32f84f849797a54a71a1b062af0c6d3005b1 (diff)
downloadtcpdump-f274a23dc1767eca8f4c433f6bd11ac5dbf4f31e.tar.gz
improve previous NDO conversions
Diffstat (limited to 'print-ascii.c')
-rw-r--r--print-ascii.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/print-ascii.c b/print-ascii.c
index 2f05c387..f83d401a 100644
--- a/print-ascii.c
+++ b/print-ascii.c
@@ -36,6 +36,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
@@ -43,7 +44,6 @@
#include <tcpdump-stdinc.h>
#include <stdio.h>
-#include "netdissect.h"
#include "interface.h"
#define ASCII_LINELENGTH 300
@@ -54,11 +54,12 @@
(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,
+ register const u_char *cp, register u_int length)
{
- register int s;
+ register u_char s;
- putchar('\n');
+ ND_PRINT((ndo, "\n"));
while (length > 0) {
s = *cp++;
length--;
@@ -73,13 +74,13 @@ ascii_print(register const u_char *cp, register u_int 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));
}
}
}