| 65 | } |
| 66 | |
| 67 | static void status_vprintf(struct wt_status *s, int at_bol, const char *color, |
| 68 | const char *fmt, va_list ap, const char *trail) |
| 69 | { |
| 70 | struct strbuf sb = STRBUF_INIT; |
| 71 | struct strbuf linebuf = STRBUF_INIT; |
| 72 | const char *line, *eol; |
| 73 | |
| 74 | strbuf_vaddf(&sb, fmt, ap); |
| 75 | if (!sb.len) { |
| 76 | if (s->display_comment_prefix) { |
| 77 | strbuf_addstr(&sb, comment_line_str); |
| 78 | if (!trail) |
| 79 | strbuf_addch(&sb, ' '); |
| 80 | } |
| 81 | color_print_strbuf(s->fp, color, &sb); |
| 82 | if (trail) |
| 83 | fprintf(s->fp, "%s", trail); |
| 84 | strbuf_release(&sb); |
| 85 | return; |
| 86 | } |
| 87 | for (line = sb.buf; *line; line = eol + 1) { |
| 88 | eol = strchr(line, '\n'); |
| 89 | |
| 90 | strbuf_reset(&linebuf); |
| 91 | if (at_bol && s->display_comment_prefix) { |
| 92 | strbuf_addstr(&linebuf, comment_line_str); |
| 93 | if (*line != '\n' && *line != '\t') |
| 94 | strbuf_addch(&linebuf, ' '); |
| 95 | } |
| 96 | if (eol) |
| 97 | strbuf_add(&linebuf, line, eol - line); |
| 98 | else |
| 99 | strbuf_addstr(&linebuf, line); |
| 100 | color_print_strbuf(s->fp, color, &linebuf); |
| 101 | if (eol) |
| 102 | fprintf(s->fp, "\n"); |
| 103 | else |
| 104 | break; |
| 105 | at_bol = 1; |
| 106 | } |
| 107 | if (trail) |
| 108 | fprintf(s->fp, "%s", trail); |
| 109 | strbuf_release(&linebuf); |
| 110 | strbuf_release(&sb); |
| 111 | } |
| 112 | |
| 113 | void status_printf_ln(struct wt_status *s, const char *color, |
| 114 | const char *fmt, ...) |
no test coverage detected