From a2cca1adeab6bb1a47542c6422ddcd6d87276c71 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Fri, 9 Nov 2012 23:22:10 +0100 Subject: [PATCH] monitor: Allow printing with different indents --- monitor/display.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/monitor/display.h b/monitor/display.h index 34199e791..28ea9fee7 100644 --- a/monitor/display.h +++ b/monitor/display.h @@ -40,13 +40,14 @@ bool use_color(void); #define COLOR_ERROR "\x1B[1;31m" -#define print_text(color, fmt, args...) do { \ - printf("%-8c%s" fmt "%s\n", ' ', \ - use_color() ? color : "", ## args, \ +#define print_indent(indent, color, fmt, args...) do { \ + printf("%*c%s" fmt "%s\n", (indent), ' ', \ + use_color() ? (color) : "", ## args, \ use_color() ? COLOR_OFF : ""); \ } while (0); -#define print_field(fmt, args...) print_text(COLOR_OFF, fmt, ## args) +#define print_text(color, fmt, args...) print_indent(8, color, fmt, ## args) +#define print_field(fmt, args...) print_indent(8, COLOR_OFF, fmt, ## args) int num_columns(void); -- 2.47.3