From: Guy Harris Date: Sun, 14 Nov 2021 03:08:26 +0000 (-0800) Subject: EAP: get rid of trailing commas in lists. X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/fd5f8f865a3cecc437818a465113842aa0a8077d EAP: get rid of trailing commas in lists. Don't print a comma separator after items; print them before items if an item has already been printed from which the new item needs to be separated. --- diff --git a/print-eap.c b/print-eap.c index f8a732af..e154165a 100644 --- a/print-eap.c +++ b/print-eap.c @@ -153,6 +153,7 @@ eap_print(netdissect_options *ndo, { u_int type, subtype, len; u_int count; + const char *sep; type = GET_U_1(cp); len = GET_BE_U_2(cp + 2); @@ -218,10 +219,12 @@ eap_print(netdissect_options *ndo, ND_PRINT(" (too short for EAP Legacy NAK request/response)"); return; } + sep = ""; for (count = 5; count < len; count++) { - ND_PRINT(" %s (%u),", + ND_PRINT("%s %s (%u)", sep, tok2str(eap_type_values, "unknown", GET_U_1((cp + count))), GET_U_1(cp + count)); + sep = ","; } break; @@ -234,7 +237,7 @@ eap_print(netdissect_options *ndo, if (subtype == EAP_TYPE_TTLS) ND_PRINT(" TTLSv%u", EAP_TTLS_VERSION(GET_U_1((cp + 5)))); - ND_PRINT(" flags [%s] 0x%02x,", + ND_PRINT(" flags [%s] 0x%02x", bittok2str(eap_tls_flags_values, "none", GET_U_1((cp + 5))), GET_U_1(cp + 5)); @@ -243,7 +246,7 @@ eap_print(netdissect_options *ndo, ND_PRINT(" (too short for EAP TLS/TTLS request/response with length)"); return; } - ND_PRINT(" len %u", GET_BE_U_4(cp + 6)); + ND_PRINT(", len %u", GET_BE_U_4(cp + 6)); } break; @@ -254,7 +257,7 @@ eap_print(netdissect_options *ndo, } ND_PRINT(" FASTv%u", EAP_TTLS_VERSION(GET_U_1((cp + 5)))); - ND_PRINT(" flags [%s] 0x%02x,", + ND_PRINT(" flags [%s] 0x%02x", bittok2str(eap_tls_flags_values, "none", GET_U_1((cp + 5))), GET_U_1(cp + 5)); @@ -263,7 +266,7 @@ eap_print(netdissect_options *ndo, ND_PRINT(" (too short for EAP FAST request/response with length)"); return; } - ND_PRINT(" len %u", GET_BE_U_4(cp + 6)); + ND_PRINT(", len %u", GET_BE_U_4(cp + 6)); } /* FIXME - TLV attributes follow */ @@ -275,7 +278,7 @@ eap_print(netdissect_options *ndo, ND_PRINT(" (too short for EAP SIM/AKA request/response)"); return; } - ND_PRINT(" subtype [%s] 0x%02x,", + ND_PRINT(" subtype [%s] 0x%02x", tok2str(eap_aka_subtype_values, "unknown", GET_U_1((cp + 5))), GET_U_1(cp + 5));