X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=color.c;h=124ba331c7f798b9b922fc8482dbc215202b99a6;hb=8f321a39257a06db014a3b6ae5dce839821cdb16;hp=d8c8399d5916432eaa4122175f5e5d7ce209001b;hpb=659db3f673fe199bad6ce9cc625d3a1b098bfbcf;p=git.git diff --git a/color.c b/color.c index d8c8399d5..124ba331c 100644 --- a/color.c +++ b/color.c @@ -1,8 +1,5 @@ -#include "color.h" #include "cache.h" -#include "git-compat-util.h" - -#include +#include "color.h" #define COLOR_RESET "\033[m" @@ -138,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; }