X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit%2Futils.c;h=4a822814609ee26811bb6eb15c0ad4dc036d468a;hb=dba8d7a9fb79dd7a776478781736c2425b19bd17;hp=3e465e20b90ed8cef2cd1c6859a48c56ed71344c;hpb=5225f3ae85288ef10b5f0609f0775b5e9d394efb;p=citadel.git diff --git a/webcit/utils.c b/webcit/utils.c index 3e465e20b..4a8228146 100644 --- a/webcit/utils.c +++ b/webcit/utils.c @@ -127,35 +127,14 @@ long stresc(char *target, long tSize, char *strbuf, int nbsp, int nolinebreaks) return (bptr - target); } - -void escputs1(const char *strbuf, int nbsp, int nolinebreaks) -{ - StrEscAppend(WC->WBuf, NULL, strbuf, nbsp, nolinebreaks); -} - -void StrEscputs1(const StrBuf *strbuf, int nbsp, int nolinebreaks) -{ - StrEscAppend(WC->WBuf, strbuf, NULL, nbsp, nolinebreaks); -} - /* * static wrapper for ecsputs1 */ void escputs(const char *strbuf) { - escputs1(strbuf, 0, 0); + StrEscAppend(WC->WBuf, NULL, strbuf, 0, 0); } - -/* - * static wrapper for ecsputs1 - */ -void StrEscPuts(const StrBuf *strbuf) -{ - StrEscputs1(strbuf, 0, 0); -} - - /* * urlescape buffer and print it to the client */ @@ -164,13 +143,6 @@ void urlescputs(const char *strbuf) StrBufUrlescAppend(WC->WBuf, NULL, strbuf); } -/* - * urlescape buffer and print it to the client - */ -void UrlescPutStrBuf(const StrBuf *strbuf) -{ - StrBufUrlescAppend(WC->WBuf, strbuf, NULL); -} /** * urlescape buffer and print it as header @@ -181,102 +153,6 @@ void hurlescputs(const char *strbuf) } -/* - * Copy a string, escaping characters for JavaScript strings. - */ -void jsesc(char *target, size_t tlen, char *strbuf) -{ - int len; - char *tend; - char *send; - char *tptr; - char *sptr; - - target[0]='\0'; - len = strlen (strbuf); - send = strbuf + len; - tend = target + tlen; - sptr = strbuf; - tptr = target; - - while (!IsEmptyStr(sptr) && - (sptr < send) && - (tptr < tend)) { - - if (*sptr == '<') - *tptr = '['; - else if (*sptr == '>') - *tptr = ']'; - else if (*sptr == '\'') { - if (tend - tptr < 3) - return; - *(tptr++) = '\\'; - *tptr = '\''; - } - else if (*sptr == '"') { - if (tend - tptr < 8) - return; - *(tptr++) = '&'; - *(tptr++) = 'q'; - *(tptr++) = 'u'; - *(tptr++) = 'o'; - *(tptr++) = 't'; - *tptr = ';'; - } - else if (*sptr == '&') { - if (tend - tptr < 7) - return; - *(tptr++) = '&'; - *(tptr++) = 'a'; - *(tptr++) = 'm'; - *(tptr++) = 'p'; - *tptr = ';'; - } else { - *tptr = *sptr; - } - tptr++; sptr++; - } - *tptr = '\0'; -} - -/* - * escape and print javascript - */ -void jsescputs(char *strbuf) -{ - char outbuf[SIZ]; - - jsesc(outbuf, SIZ, strbuf); - wc_printf("%s", outbuf); -} - -/* - * print a string to the client after cleaning it with msgesc() and stresc() - */ -void msgescputs1( char *strbuf) -{ - StrBuf *OutBuf; - - if ((strbuf == NULL) || IsEmptyStr(strbuf)) - return; - OutBuf = NewStrBuf(); - StrMsgEscAppend(OutBuf, NULL, strbuf); - StrEscAppend(WC->WBuf, OutBuf, NULL, 0, 0); - FreeStrBuf(&OutBuf); -} - -/* - * print a string to the client after cleaning it with msgesc() - */ -void msgescputs(char *strbuf) { - if ((strbuf != NULL) && !IsEmptyStr(strbuf)) - StrMsgEscAppend(WC->WBuf, NULL, strbuf); -} - - - - - /* * Output a string to the client as a CDATA block */