From becbdae82bb8bb193c2f1e9d8b32a60bdef8b0e4 Mon Sep 17 00:00:00 2001 From: Jonathan Nieder Date: Fri, 25 Feb 2011 23:09:41 -0600 Subject: wt-status: add helpers for printing wt-status lines Introduce status_printf{,_ln,_more} wrapper functions around color_vfprintf() which take care of adding "#" to the beginning of status lines automatically. The semantics: - status_printf() is just like color_fprintf() but it adds a "# " at the beginning of each line of output; - status_printf_ln() is a convenience function that additionally adds "\n" at the end; - status_printf_more() is a variant of status_printf() used to continue lines that have already started. It suppresses the "#" at the beginning of the first line. Helped-by: Junio C Hamano Signed-off-by: Jonathan Nieder Signed-off-by: Junio C Hamano --- color.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'color.h') diff --git a/color.h b/color.h index 170ff4074d..c0528cf087 100644 --- a/color.h +++ b/color.h @@ -1,6 +1,8 @@ #ifndef COLOR_H #define COLOR_H +struct strbuf; + /* 2 + (2 * num_attrs) + 8 + 1 + 8 + 'm' + NUL */ /* "\033[1;2;4;5;7;38;5;2xx;48;5;2xxm\0" */ /* @@ -64,6 +66,7 @@ __attribute__((format (printf, 3, 4))) int color_fprintf(FILE *fp, const char *color, const char *fmt, ...); __attribute__((format (printf, 3, 4))) int color_fprintf_ln(FILE *fp, const char *color, const char *fmt, ...); +void color_print_strbuf(FILE *fp, const char *color, const struct strbuf *sb); int color_is_nil(const char *color); -- cgit v1.2.1