From 5225f3ae85288ef10b5f0609f0775b5e9d394efb Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Wed, 25 May 2011 17:53:36 -0400 Subject: [PATCH] New function cdataout() for sending a string to the client as a CDATA block --- webcit/utils.c | 25 +++++++++++++++++++++++++ webcit/webcit.h | 1 + 2 files changed, 26 insertions(+) diff --git a/webcit/utils.c b/webcit/utils.c index 8f19109d6..3e465e20b 100644 --- a/webcit/utils.c +++ b/webcit/utils.c @@ -275,3 +275,28 @@ void msgescputs(char *strbuf) { + + +/* + * Output a string to the client as a CDATA block + */ +void cdataout(char *rawdata) +{ + char *ptr = rawdata; + wc_printf("", 3)) { + wc_printf("]]]]>"); + ++ptr; ++ptr; ++ptr; + } + else { + wc_printf("%c", ptr[0]); + ++ptr; + } + } + + wc_printf("]]>"); +} + diff --git a/webcit/webcit.h b/webcit/webcit.h index c67111119..61644a0a2 100644 --- a/webcit/webcit.h +++ b/webcit/webcit.h @@ -694,6 +694,7 @@ void output_headers( int do_httpheaders, int suppress_check, int cache); void output_custom_content_header(const char *ctype); +void cdataout(char *rawdata); #ifdef UBER_VERBOSE_DEBUGGING #define wc_printf(...) wcc_printf(__FILE__, __FUNCTION__, __LINE__, __VA_ARGS__) -- 2.39.2