]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-ascii.c
icmp: clean up the extension code and comments.
[tcpdump] / print-ascii.c
index 2f5fe8547f6dc10da6e803c3de0e8ec7d8a4e676..64b40424333fe7daefde0a74e33d647ee622cee1 100644 (file)
@@ -102,8 +102,8 @@ ascii_print(netdissect_options *ndo,
 }
 
 static void
 }
 
 static void
-hex_and_ascii_print_with_offset(netdissect_options *ndo, const char *ident,
-    const u_char *cp, u_int length, u_int oset)
+hex_and_ascii_print_with_offset(netdissect_options *ndo, const char *indent,
+                               const u_char *cp, u_int length, u_int offset)
 {
        u_int caplength;
        u_int i;
 {
        u_int caplength;
        u_int i;
@@ -135,10 +135,10 @@ hex_and_ascii_print_with_offset(netdissect_options *ndo, const char *ident,
                if (i >= HEXDUMP_SHORTS_PER_LINE) {
                        *hsp = *asp = '\0';
                        ND_PRINT("%s0x%04x: %-*s  %s",
                if (i >= HEXDUMP_SHORTS_PER_LINE) {
                        *hsp = *asp = '\0';
                        ND_PRINT("%s0x%04x: %-*s  %s",
-                           ident, oset, HEXDUMP_HEXSTUFF_PER_LINE,
+                           indent, offset, HEXDUMP_HEXSTUFF_PER_LINE,
                            hexstuff, asciistuff);
                        i = 0; hsp = hexstuff; asp = asciistuff;
                            hexstuff, asciistuff);
                        i = 0; hsp = hexstuff; asp = asciistuff;
-                       oset += HEXDUMP_BYTES_PER_LINE;
+                       offset += HEXDUMP_BYTES_PER_LINE;
                }
                nshorts--;
        }
                }
                nshorts--;
        }
@@ -154,7 +154,7 @@ hex_and_ascii_print_with_offset(netdissect_options *ndo, const char *ident,
        if (i > 0) {
                *hsp = *asp = '\0';
                ND_PRINT("%s0x%04x: %-*s  %s",
        if (i > 0) {
                *hsp = *asp = '\0';
                ND_PRINT("%s0x%04x: %-*s  %s",
-                    ident, oset, HEXDUMP_HEXSTUFF_PER_LINE,
+                    indent, offset, HEXDUMP_HEXSTUFF_PER_LINE,
                     hexstuff, asciistuff);
        }
        if (truncated)
                     hexstuff, asciistuff);
        }
        if (truncated)
@@ -162,10 +162,10 @@ hex_and_ascii_print_with_offset(netdissect_options *ndo, const char *ident,
 }
 
 void
 }
 
 void
-hex_and_ascii_print(netdissect_options *ndo, const char *ident,
-    const u_char *cp, u_int length)
+hex_and_ascii_print(netdissect_options *ndo, const char *indent,
+                   const u_char *cp, u_int length)
 {
 {
-       hex_and_ascii_print_with_offset(ndo, ident, cp, length, 0);
+       hex_and_ascii_print_with_offset(ndo, indent, cp, length, 0);
 }
 
 /*
 }
 
 /*
@@ -173,8 +173,8 @@ hex_and_ascii_print(netdissect_options *ndo, const char *ident,
  */
 void
 hex_print_with_offset(netdissect_options *ndo,
  */
 void
 hex_print_with_offset(netdissect_options *ndo,
-                      const char *ident, const u_char *cp, u_int length,
-                     u_int oset)
+                      const char *indent, const u_char *cp, u_int length,
+                     u_int offset)
 {
        u_int caplength;
        u_int i, s;
 {
        u_int caplength;
        u_int i, s;
@@ -190,8 +190,8 @@ hex_print_with_offset(netdissect_options *ndo,
        i = 0;
        while (nshorts != 0) {
                if ((i++ % 8) == 0) {
        i = 0;
        while (nshorts != 0) {
                if ((i++ % 8) == 0) {
-                       ND_PRINT("%s0x%04x: ", ident, oset);
-                       oset += HEXDUMP_BYTES_PER_LINE;
+                       ND_PRINT("%s0x%04x: ", indent, offset);
+                       offset += HEXDUMP_BYTES_PER_LINE;
                }
                s = GET_U_1(cp);
                cp++;
                }
                s = GET_U_1(cp);
                cp++;
@@ -201,7 +201,7 @@ hex_print_with_offset(netdissect_options *ndo,
        }
        if (length & 1) {
                if ((i % 8) == 0)
        }
        if (length & 1) {
                if ((i % 8) == 0)
-                       ND_PRINT("%s0x%04x: ", ident, oset);
+                       ND_PRINT("%s0x%04x: ", indent, offset);
                ND_PRINT(" %02x", GET_U_1(cp));
        }
        if (truncated)
                ND_PRINT(" %02x", GET_U_1(cp));
        }
        if (truncated)
@@ -210,9 +210,9 @@ hex_print_with_offset(netdissect_options *ndo,
 
 void
 hex_print(netdissect_options *ndo,
 
 void
 hex_print(netdissect_options *ndo,
-         const char *ident, const u_char *cp, u_int length)
+         const char *indent, const u_char *cp, u_int length)
 {
 {
-       hex_print_with_offset(ndo, ident, cp, length, 0);
+       hex_print_with_offset(ndo, indent, cp, length, 0);
 }
 
 #ifdef MAIN
 }
 
 #ifdef MAIN