summaryrefslogtreecommitdiff
path: root/color.c
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@redhat.com>2007-09-17 20:06:42 -0400
committerJunio C Hamano <gitster@pobox.com>2007-09-19 12:52:19 -0700
commitf26a0012262106e0c7e92d8d07f00611112d3a8d (patch)
tree819a350da21af2493a29a55519e4924a0b29697f /color.c
parent6b30852ded5074652f4304a303521932235c62db (diff)
downloadgit-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.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/color.c b/color.c
index 09d82eec3d..124ba331c7 100644
--- a/color.c
+++ b/color.c
@@ -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;
}