tools/demo-client, demo-server: use the new color print functions

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2020-08-27 11:16:05 +10:00
parent c169e10af7
commit 22930d0d2b
2 changed files with 6 additions and 12 deletions

View file

@ -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);

View file

@ -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);