void wsh_client_clear_colors(void) { gboolean colors = wsh_client_has_colors(); if (colors && isatty(fileno(stderr))) g_fprintf(stderr, "%s", "\x1b[39m"); if (colors && isatty(fileno(stdout))) g_fprintf(stdout, "%s", "\x1b[39m"); }
static void color_print(const char* color, FILE* file, const char* format, va_list args) { gboolean colors = wsh_client_has_colors(); if (colors && isatty(fileno(file))) g_fprintf(file, "%s", color); g_vfprintf(file, format, args); if (colors && isatty(fileno(file))) g_fprintf(file, "%s", "\x1b[39m"); }
void wshc_verbose_print(wshc_output_info_t* out, const gchar* format, ...) { if (out->verbose) { gboolean colors = wsh_client_has_colors(); va_list args; va_start(args, format); g_mutex_lock(out->mut); if (colors) g_printerr("\x1b[39m"); g_printerr("verbose: "); g_vfprintf(stderr, format, args); g_mutex_unlock(out->mut); va_end(args); } }