]> The Tcpdump Group git mirrors - tcpdump/commitdiff
EAP: get rid of trailing commas in lists.
authorGuy Harris <[email protected]>
Sun, 14 Nov 2021 03:08:26 +0000 (19:08 -0800)
committerGuy Harris <[email protected]>
Sun, 14 Nov 2021 03:08:26 +0000 (19:08 -0800)
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.

print-eap.c

index f8a732af04bfac7cf5b027c8d83fad6c01c8416e..e154165a455f88860f01f3843888c54c6983ae6d 100644 (file)
@@ -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));