From: Hugo Villeneuve Date: Fri, 14 Nov 2025 17:51:47 +0000 (-0500) Subject: [SUBMIT] tlv_eeprom: remove leading space when displaying TLV binary value X-Git-Url: http://gitweb.hugovil.com/?a=commitdiff_plain;h=87e4814b80a805c9cb36e9f7ea96a47e1cfdac0c;p=mtlv.git [SUBMIT] tlv_eeprom: remove leading space when displaying TLV binary value When displaying TLV binary values, as in this example: TLV Name Code Len Value -------------------- ---- --- ----- Product Name 0x21 6 my-product Vendor Extension 0xFD 6 0x66 0x6F 0x6F 0x62 0x61 0x72 CRC-32 0xFE 4 0x3CAAF7AE There is a leading space before the first byte. Fix by not printing the space character for the first value. Signed-off-by: Hugo Villeneuve --- diff --git a/src/tlv_eeprom.c b/src/tlv_eeprom.c index a6564e9..fdb8349 100644 --- a/src/tlv_eeprom.c +++ b/src/tlv_eeprom.c @@ -339,7 +339,11 @@ static void decode_tlv_value(struct tlvinfo_tlv *tlv, char *value, int value_len i++) { char dec_val[DECODE_VALUE_MAX]; - sprintf(dec_val, " 0x%02X", tlv->value[i]); + sprintf(dec_val, "0x%02X", tlv->value[i]); + + if (i != 0) + strcat(value, " "); + strcat(value, dec_val); } break;