diff options
author | Kristian Høgsberg <krh@redhat.com> | 2007-09-17 20:06:42 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2007-09-19 12:52:19 -0700 |
commit | f26a0012262106e0c7e92d8d07f00611112d3a8d (patch) | |
tree | 819a350da21af2493a29a55519e4924a0b29697f /color.c | |
parent | 6b30852ded5074652f4304a303521932235c62db (diff) | |
download | git-f26a0012262106e0c7e92d8d07f00611112d3a8d.tar.gz |
Enable wt-status output to a given FILE pointer.
Still defaults to stdout, but you can now override wt_status.fp after
calling wt_status_prepare().
Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'color.c')
-rw-r--r-- | color.c | 18 |
1 files changed, 9 insertions, 9 deletions
@@ -135,39 +135,39 @@ int git_config_colorbool(const char *var, const char *value) return git_config_bool(var, value); } -static int color_vprintf(const char *color, const char *fmt, +static int color_vfprintf(FILE *fp, const char *color, const char *fmt, va_list args, const char *trail) { int r = 0; if (*color) - r += printf("%s", color); - r += vprintf(fmt, args); + r += fprintf(fp, "%s", color); + r += vfprintf(fp, fmt, args); if (*color) - r += printf("%s", COLOR_RESET); + r += fprintf(fp, "%s", COLOR_RESET); if (trail) - r += printf("%s", trail); + r += fprintf(fp, "%s", trail); return r; } -int color_printf(const char *color, const char *fmt, ...) +int color_fprintf(FILE *fp, const char *color, const char *fmt, ...) { va_list args; int r; va_start(args, fmt); - r = color_vprintf(color, fmt, args, NULL); + r = color_vfprintf(fp, color, fmt, args, NULL); va_end(args); return r; } -int color_printf_ln(const char *color, const char *fmt, ...) +int color_fprintf_ln(FILE *fp, const char *color, const char *fmt, ...) { va_list args; int r; va_start(args, fmt); - r = color_vprintf(color, fmt, args, "\n"); + r = color_vfprintf(fp, color, fmt, args, "\n"); va_end(args); return r; } |