diff options
author | Junio C Hamano <gitster@pobox.com> | 2012-05-02 13:51:35 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-05-02 13:51:35 -0700 |
commit | 1be65eda6a7018445ebdd9cfec4b1caab4db34ba (patch) | |
tree | 948dffe3ecb2baa0667b61bae3312232235f9011 /strbuf.c | |
parent | Merge branch 'mm/simple-push' (diff) | |
parent | help: replace underlining "help -a" headers using hyphens with a blank line (diff) | |
download | tgif-1be65eda6a7018445ebdd9cfec4b1caab4db34ba.tar.xz |
Merge branch 'nd/i18n'
More message strings marked for i18n.
By Nguyễn Thái Ngọc Duy (10) and Jonathan Nieder (1)
* nd/i18n:
help: replace underlining "help -a" headers using hyphens with a blank line
i18n: bundle: mark strings for translation
i18n: index-pack: mark strings for translation
i18n: apply: update say_patch_name to give translators complete sentence
i18n: apply: mark strings for translation
i18n: remote: mark strings for translation
i18n: make warn_dangling_symref() automatically append \n
i18n: help: mark strings for translation
i18n: mark relative dates for translation
strbuf: convenience format functions with \n automatically appended
Makefile: feed all header files to xgettext
Diffstat (limited to 'strbuf.c')
-rw-r--r-- | strbuf.c | 33 |
1 files changed, 33 insertions, 0 deletions
@@ -464,3 +464,36 @@ void strbuf_addstr_urlencode(struct strbuf *sb, const char *s, { strbuf_add_urlencode(sb, s, strlen(s), reserved); } + +void strbuf_addf_ln(struct strbuf *sb, const char *fmt, ...) +{ + va_list ap; + va_start(ap, fmt); + strbuf_vaddf(sb, fmt, ap); + va_end(ap); + strbuf_addch(sb, '\n'); +} + +int printf_ln(const char *fmt, ...) +{ + int ret; + va_list ap; + va_start(ap, fmt); + ret = vprintf(fmt, ap); + va_end(ap); + if (ret < 0 || putchar('\n') == EOF) + return -1; + return ret + 1; +} + +int fprintf_ln(FILE *fp, const char *fmt, ...) +{ + int ret; + va_list ap; + va_start(ap, fmt); + ret = vfprintf(fp, fmt, ap); + va_end(ap); + if (ret < 0 || putc('\n', fp) == EOF) + return -1; + return ret + 1; +} |