From 22930d0d2b2aeaa2c92badeb3abded9b94b4b352 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 27 Aug 2020 11:16:05 +1000 Subject: [PATCH] tools/demo-client, demo-server: use the new color print functions Signed-off-by: Peter Hutterer --- tools/ei-demo-client.c | 9 +++------ tools/eis-demo-server.c | 9 +++------ 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/tools/ei-demo-client.c b/tools/ei-demo-client.c index 7584db1..f86a156 100644 --- a/tools/ei-demo-client.c +++ b/tools/ei-demo-client.c @@ -51,15 +51,12 @@ static inline void _printf_(1, 2) colorprint(const char *format, ...) { - static const char *color = ANSI_BG_RGB(230, 0, 230); - static const char *reset = ansi_colorcode[RESET]; - + static uint64_t color = 0; run_only_once { - if (!isatty(STDOUT_FILENO)) - color = reset = ""; + color = rgb(1, 1, 1) | rgb_bg(230, 0, 230); } - printf("%sEI socket client:%s ", color, reset); + cprintf(color, "EI socket client: "); va_list args; va_start(args, format); vprintf(format, args); diff --git a/tools/eis-demo-server.c b/tools/eis-demo-server.c index b6354e8..fd63ad8 100644 --- a/tools/eis-demo-server.c +++ b/tools/eis-demo-server.c @@ -72,15 +72,12 @@ static inline void _printf_(1, 2) colorprint(const char *format, ...) { - static const char *color = ANSI_BG_RGB(255, 127, 0); - static const char *reset = ansi_colorcode[RESET]; - + static uint64_t color = 0; run_only_once { - if (!isatty(STDOUT_FILENO)) - color = reset = ""; + color = rgb(1, 1, 1) | rgb_bg(255, 127, 0); } - printf("%sEIS socket server:%s ", color, reset); + cprintf(color, "EIS socket server: "); va_list args; va_start(args, format); vprintf(format, args);