X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit%2Fsubst.c;h=907e1a34f289f3ed9f57239a9daab6da7e005306;hb=74fb658b25f766426a43cb1a6d55a699bb05dbc5;hp=54a59a425487e7ec8c45c9a5997dfb5c367fc922;hpb=00699732729311d6637f7946fd764071e9977c6f;p=citadel.git diff --git a/webcit/subst.c b/webcit/subst.c index 54a59a425..907e1a34f 100644 --- a/webcit/subst.c +++ b/webcit/subst.c @@ -1233,8 +1233,7 @@ void *load_template(WCTemplate *NewTemplate) pE = pS + StrLength(NewTemplate->Data); while (pch < pE) { const char *pts, *pte; - int InQuotes = 0; - int InDoubleQuotes = 0; + char InQuotes = '\0'; void *pv; /** Find one */ @@ -1253,13 +1252,24 @@ void *load_template(WCTemplate *NewTemplate) /** Found one? parse it. */ for (; pch <= pE - 1; pch ++) { - if (*pch == '"') - InDoubleQuotes = ! InDoubleQuotes; - else if (*pch == '\'') - InQuotes = ! InQuotes; - else if ((!InQuotes && !InDoubleQuotes) && - ((*pch!='\\')&&(*(pch + 1)=='>'))) { - pch ++; + if ((!InQuotes) && + ((*pch == '\'') || (*pch == '"'))) + { + InQuotes = *pch; + } + else if (InQuotes && (InQuotes == *pch)) + { + InQuotes = '\0'; + } + else if ((InQuotes) && + (*pch == '\\') && + (*(pch + 1) == InQuotes)) + { + pch++; + } + else if ((!InQuotes) && + (*pch == '>')) + { break; } }