X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=quote.c;h=e220dcc280d9ed6be2e2357e2660c7e828f3631b;hb=5f468c4805c785115cd9c5f6a8f299f23a9034f5;hp=1910d000a5d288734aaea24da617481223ff9f56;hpb=75dedd5a21246be03ae443e9fc6a9f75c6d2995b;p=git.git diff --git a/quote.c b/quote.c index 1910d000a..e220dcc28 100644 --- a/quote.c +++ b/quote.c @@ -45,6 +45,23 @@ size_t sq_quote_buf(char *dst, size_t n, const char *src) return len; } +void sq_quote_print(FILE *stream, const char *src) +{ + char c; + + fputc('\'', stream); + while ((c = *src++)) { + if (need_bs_quote(c)) { + fputs("'\\", stream); + fputc(c, stream); + fputc('\'', stream); + } else { + fputc(c, stream); + } + } + fputc('\'', stream); +} + char *sq_quote(const char *src) { char *buf;