diff --git a/src/mu-str.c b/src/mu-str.c index f653eb02..b8e8703e 100644 --- a/src/mu-str.c +++ b/src/mu-str.c @@ -533,4 +533,3 @@ leave: return nick; } - diff --git a/src/mu-str.h b/src/mu-str.h index 44f9b9f4..f00e69ca 100644 --- a/src/mu-str.h +++ b/src/mu-str.h @@ -305,7 +305,6 @@ gchar* mu_str_guess_first_name (const char* name) gchar* mu_str_guess_last_name (const char* name) G_GNUC_WARN_UNUSED_RESULT; - G_END_DECLS #endif /*__MU_STR_H__*/ diff --git a/src/mu-util.c b/src/mu-util.c index 882bf97a..6081bb04 100644 --- a/src/mu-util.c +++ b/src/mu-util.c @@ -145,43 +145,6 @@ mu_util_cache_dir (void) } -void -mu_util_color_print (MuColor col, const char *str) -{ - const char *pfx; - const char *reset = "\x1b[0m"; - - static int is_tty = -1; - - if (!str) - return; - - if (is_tty == -1) - is_tty = isatty(fileno(stdout)) ? 1 : 0; - - switch (col) { - case MU_COLOR_RED : pfx = "\x1b[31m"; break; - case MU_COLOR_GREEN : pfx = "\x1b[32m"; break; - case MU_COLOR_YELLOW : pfx = "\x1b[33m"; break; - case MU_COLOR_BLUE : pfx = "\x1b[34m"; break; - case MU_COLOR_MAGENTA : pfx = "\x1b[35m"; break; - case MU_COLOR_CYAN : pfx = "\x1b[36m"; break; - - default: - g_critical ("invalid color %u", (unsigned)col); - return; - } - - if (is_tty) - fputs (pfx, stdout); - - fputs (str, stdout); - - if (is_tty) - fputs (reset, stdout); -} - - gboolean mu_util_init_system (void) { diff --git a/src/mu-util.h b/src/mu-util.h index b7633eb8..0ebcba0f 100644 --- a/src/mu-util.h +++ b/src/mu-util.h @@ -105,26 +105,6 @@ gboolean mu_util_check_dir (const gchar* path, gboolean readable, const char* mu_util_cache_dir (void) G_GNUC_CONST; -enum _MuColor { - MU_COLOR_RED = 0, - MU_COLOR_GREEN, - MU_COLOR_YELLOW, - MU_COLOR_BLUE, - MU_COLOR_MAGENTA, - MU_COLOR_CYAN -}; -typedef enum _MuColor MuColor; - - -/** - * print string to stdout in a certain color if the output is to a - * sufficiently capable tty; otherwise, just print the string. Color - * will *only* be printed if stdout actually is a tty. - * - * @param col a MuColor - * @param str a string, or NULL - */ -void mu_util_color_print (MuColor col, const char *str); /** * create a writeable file and return its file descriptor (which @@ -413,6 +393,15 @@ enum _MuError { }; typedef enum _MuError MuError; + +#define MU_COLOR_RED "\x1b[31m" +#define MU_COLOR_GREEN "\x1b[32m" +#define MU_COLOR_YELLOW "\x1b[33m" +#define MU_COLOR_BLUE "\x1b[34m" +#define MU_COLOR_MAGENTA "\x1b[35m" +#define MU_COLOR_CYAN "\x1b[36m" +#define MU_COLOR_DEFAULT "\x1b[0m" + G_END_DECLS #endif /*__MU_UTIL_H__*/