#define COLOR_ERROR "\x1B[1;31m"
-#define print_indent(indent, color, prefix, title, fmt, args...) do { \
- printf("%*c%s%s%s%s" fmt "\n", (indent), ' ', \
- use_color() ? (color) : "", prefix, title, \
- use_color() ? COLOR_OFF : "", ## args); \
+#define print_indent(indent, color1, prefix, title, color2, fmt, args...) \
+do { \
+ printf("%*c%s%s%s%s" fmt "%s\n", (indent), ' ', \
+ use_color() ? (color1) : "", prefix, title, \
+ use_color() ? (color2) : "", ## args, \
+ use_color() ? COLOR_OFF : ""); \
} while (0);
#define print_text(color, fmt, args...) \
- print_indent(8, color, "", "", fmt, ## args)
+ print_indent(8, COLOR_OFF, "", "", color, fmt, ## args)
#define print_field(fmt, args...) \
- print_indent(8, COLOR_OFF, "", "", fmt, ## args)
+ print_indent(8, COLOR_OFF, "", "", COLOR_OFF, fmt, ## args)
int num_columns(void);
}
print_indent(6, opcode_color, "L2CAP: ", opcode_str,
+ COLOR_OFF,
" (0x%2.2x) ident %d len %d",
hdr->code, hdr->ident, len);
else
opcode_str = "Unknown";
- print_indent(6, COLOR_CYAN, "AMP: ", opcode_str,
+ print_indent(6, COLOR_CYAN, "AMP: ", opcode_str, COLOR_OFF,
" (0x%2.2x) ident %d len %d", opcode, ident, len);
packet_hexdump(data + 6, size - 8);
else
opcode_str = "Unknown";
- print_indent(6, COLOR_CYAN, "ATT: ", opcode_str,
+ print_indent(6, COLOR_CYAN, "ATT: ", opcode_str, COLOR_OFF,
" (0x%2.2x) len %d", opcode, size - 1);
packet_hexdump(data + 1, size - 1);
else
opcode_str = "Unknown";
- print_indent(6, COLOR_CYAN, "SMP: ", opcode_str,
+ print_indent(6, COLOR_CYAN, "SMP: ", opcode_str, COLOR_OFF,
" (0x%2.2x) len %d", opcode, size - 1);
packet_hexdump(data + 1, size - 1);
smp_packet(data, len);
break;
default:
- print_indent(6, COLOR_CYAN, "Channel:", "",
+ print_indent(6, COLOR_CYAN, "Channel:", "", COLOR_OFF,
" %d len %d", cid, len);
packet_hexdump(data, len);
break;
opcode_str = "Unknown";
}
- print_indent(6, opcode_color, "", opcode_str,
+ print_indent(6, opcode_color, "", opcode_str, COLOR_OFF,
" (0x%2.2x|0x%4.4x) ncmd %d", ogf, ocf, evt->ncmd);
if (!opcode_data->rsp_func) {
opcode_str = "Unknown";
}
- print_indent(6, opcode_color, "", opcode_str,
+ print_indent(6, opcode_color, "", opcode_str, COLOR_OFF,
" (0x%2.2x|0x%4.4x) ncmd %d", ogf, ocf, evt->ncmd);
print_status(evt->status);
subevent_str = "Unknown";
}
- print_indent(6, subevent_color, "", subevent_str,
- " (0x%2.2x)", subevent);
+ print_indent(6, subevent_color, "", subevent_str, COLOR_OFF,
+ " (0x%2.2x)", subevent);
if (!subevent_data || !subevent_data->func) {
packet_hexdump(data + 1, size - 1);