aboutsummaryrefslogtreecommitdiff
path: root/quote.c
diff options
context:
space:
mode:
Diffstat (limited to 'quote.c')
-rw-r--r--quote.c17
1 files changed, 17 insertions, 0 deletions
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;