+ascii_print(netdissect_options *ndo,
+ const u_char *cp, u_int length)
+{
+ u_int caplength;
+ u_char s;
+ int truncated = FALSE;
+
+ ndo->ndo_protocol = "ascii";
+ caplength = ND_BYTES_AVAILABLE_AFTER(cp);
+ if (length > caplength) {
+ length = caplength;
+ truncated = TRUE;
+ }
+ ND_PRINT("\n");
+ while (length != 0) {
+ s = GET_U_1(cp);
+ cp++;
+ length--;
+ if (s == '\r') {
+ /*
+ * Don't print CRs at the end of the line; they
+ * don't belong at the ends of lines on UN*X,
+ * and the standard I/O library will give us one
+ * on Windows so we don't need to print one
+ * ourselves.
+ *
+ * In the middle of a line, just print a '.'.
+ */
+ if (length > 1 && GET_U_1(cp) != '\n')
+ ND_PRINT(".");
+ } else {
+ if (!ND_ASCII_ISGRAPH(s) &&
+ (s != '\t' && s != ' ' && s != '\n'))
+ ND_PRINT(".");
+ else
+ ND_PRINT("%c", s);
+ }
+ }
+ if (truncated)
+ nd_trunc_longjmp(ndo);
+}
+
+static void
+hex_and_ascii_print_with_offset(netdissect_options *ndo, const char *indent,
+ const u_char *cp, u_int length, u_int offset)