From: Guy Harris Date: Fri, 15 Aug 2014 22:03:46 +0000 (-0700) Subject: Use tabs consistently. X-Git-Tag: tcpdump-4.7.0-bp~46^2~5 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/e5e64498bb8fd83919d4e7f854224a1e459e4ab0 Use tabs consistently. --- diff --git a/print-cdp.c b/print-cdp.c index 64056f99..a2c3caba 100644 --- a/print-cdp.c +++ b/print-cdp.c @@ -88,14 +88,14 @@ cdp_print(netdissect_options *ndo, const u_char *pptr, u_int length, u_int caplen) { int type, len, i, j; - const u_char *tptr; + const u_char *tptr; if (caplen < CDP_HEADER_LEN) { ND_PRINT((ndo, "%s", tstr)); return; } - tptr = pptr; /* temporary pointer */ + tptr = pptr; /* temporary pointer */ ND_TCHECK2(*tptr, CDP_HEADER_LEN); ND_PRINT((ndo, "CDPv%u, ttl: %us", *tptr, *(tptr + 1))); @@ -108,130 +108,130 @@ cdp_print(netdissect_options *ndo, type = EXTRACT_16BITS(tptr); len = EXTRACT_16BITS(tptr+CDP_HEADER_OFFSET); /* object length includes the 4 bytes header length */ if (len < CDP_HEADER_LEN) { - if (ndo->ndo_vflag) - ND_PRINT((ndo, "\n\t%s (0x%02x), TLV length: %u byte%s (too short)", - tok2str(cdp_tlv_values,"unknown field type", type), - type, - len, - PLURAL_SUFFIX(len))); /* plural */ - else - ND_PRINT((ndo, ", %s TLV length %u too short", - tok2str(cdp_tlv_values,"unknown field type", type), - len)); - break; - } - tptr += CDP_HEADER_LEN; - len -= CDP_HEADER_LEN; + if (ndo->ndo_vflag) + ND_PRINT((ndo, "\n\t%s (0x%02x), TLV length: %u byte%s (too short)", + tok2str(cdp_tlv_values,"unknown field type", type), + type, + len, + PLURAL_SUFFIX(len))); /* plural */ + else + ND_PRINT((ndo, ", %s TLV length %u too short", + tok2str(cdp_tlv_values,"unknown field type", type), + len)); + break; + } + tptr += CDP_HEADER_LEN; + len -= CDP_HEADER_LEN; ND_TCHECK2(*tptr, len); - if (ndo->ndo_vflag || type == 1) { /* in non-verbose mode just print Device-ID */ + if (ndo->ndo_vflag || type == 1) { /* in non-verbose mode just print Device-ID */ - if (ndo->ndo_vflag) - ND_PRINT((ndo, "\n\t%s (0x%02x), value length: %u byte%s: ", - tok2str(cdp_tlv_values,"unknown field type", type), - type, - len, - PLURAL_SUFFIX(len))); /* plural */ + if (ndo->ndo_vflag) + ND_PRINT((ndo, "\n\t%s (0x%02x), value length: %u byte%s: ", + tok2str(cdp_tlv_values,"unknown field type", type), + type, + len, + PLURAL_SUFFIX(len))); /* plural */ - switch (type) { + switch (type) { - case 0x01: /* Device-ID */ - if (!ndo->ndo_vflag) - ND_PRINT((ndo, ", Device-ID ")); - ND_PRINT((ndo, "'")); - fn_printn(ndo, tptr, len, NULL); - ND_PRINT((ndo, "'")); + case 0x01: /* Device-ID */ + if (!ndo->ndo_vflag) + ND_PRINT((ndo, ", Device-ID ")); + ND_PRINT((ndo, "'")); + fn_printn(ndo, tptr, len, NULL); + ND_PRINT((ndo, "'")); break; - case 0x02: /* Address */ - if (cdp_print_addr(ndo, tptr, len) < 0) - goto trunc; + case 0x02: /* Address */ + if (cdp_print_addr(ndo, tptr, len) < 0) + goto trunc; break; - case 0x03: /* Port-ID */ - ND_PRINT((ndo, "'")); - fn_printn(ndo, tptr, len, NULL); - ND_PRINT((ndo, "'")); + case 0x03: /* Port-ID */ + ND_PRINT((ndo, "'")); + fn_printn(ndo, tptr, len, NULL); + ND_PRINT((ndo, "'")); break; - case 0x04: /* Capabilities */ + case 0x04: /* Capabilities */ ND_PRINT((ndo, "(0x%08x): %s", - EXTRACT_32BITS(tptr), - bittok2str(cdp_capability_values, "none", EXTRACT_32BITS(tptr)))); + EXTRACT_32BITS(tptr), + bittok2str(cdp_capability_values, "none", EXTRACT_32BITS(tptr)))); break; - case 0x05: /* Version */ - ND_PRINT((ndo, "\n\t ")); - for (i=0;i 1) { ND_PRINT((ndo, "/")); - fn_printn(ndo, tptr + 1, len - 1, NULL); - } + fn_printn(ndo, tptr + 1, len - 1, NULL); + } break; - default: - print_unknown_data(ndo, tptr, "\n\t ", len); + default: + print_unknown_data(ndo, tptr, "\n\t ", len); break; - } - } + } + } tptr = tptr+len; } - if (ndo->ndo_vflag < 1) - ND_PRINT((ndo, ", length %u", caplen)); + if (ndo->ndo_vflag < 1) + ND_PRINT((ndo, ", length %u", caplen)); return; trunc: @@ -251,7 +251,7 @@ trunc: static int cdp_print_addr(netdissect_options *ndo, - const u_char * p, int l) + const u_char * p, int l) { int pt, pl, al, num; const u_char *endp = p + l; @@ -346,7 +346,7 @@ trunc: static int cdp_print_prefixes(netdissect_options *ndo, - const u_char * p, int l) + const u_char * p, int l) { if (l % 5) goto trunc;