gitweb: Fix error in git_patchset_body for deletion in merge commit
[gitweb.git] / quote.c
diff --git a/quote.c b/quote.c
index a418a0f803f91d218b66ae89a1e8615a94ff27bc..fb9e4ca253ea9bcadbcb55dcdd62be614c66758f 100644 (file)
--- a/quote.c
+++ b/quote.c
@@ -387,3 +387,37 @@ void python_quote_print(FILE *stream, const char *src)
        }
        fputc(sq, stream);
 }
+
+void tcl_quote_print(FILE *stream, const char *src)
+{
+       char c;
+
+       fputc('"', stream);
+       while ((c = *src++)) {
+               switch (c) {
+               case '[': case ']':
+               case '{': case '}':
+               case '$': case '\\': case '"':
+                       fputc('\\', stream);
+               default:
+                       fputc(c, stream);
+                       break;
+               case '\f':
+                       fputs("\\f", stream);
+                       break;
+               case '\r':
+                       fputs("\\r", stream);
+                       break;
+               case '\n':
+                       fputs("\\n", stream);
+                       break;
+               case '\t':
+                       fputs("\\t", stream);
+                       break;
+               case '\v':
+                       fputs("\\v", stream);
+                       break;
+               }
+       }
+       fputc('"', stream);
+}