X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit%2Fserv_func.c;h=9e12d1afbbe8710fbcd23db46c3910af59a3fda3;hb=b73b5cda73bc2a5f5fa77a9caee5a542ad1c1475;hp=e9f5f8c5675e631ce11e4b3e0be72ff8b6dcf086;hpb=2e22f3313ffab43f382a2a9137e5a2a3f4994ca2;p=citadel.git diff --git a/webcit/serv_func.c b/webcit/serv_func.c index e9f5f8c56..9e12d1afb 100644 --- a/webcit/serv_func.c +++ b/webcit/serv_func.c @@ -269,57 +269,62 @@ void FmOut(StrBuf *Target, char *align, StrBuf *Source) StrBuf *Line2 = NewStrBufPlain(NULL, SIZ); int bn = 0; int bq = 0; - int i, n, done = 0; + int i; long len; int intext = 0; StrBufAppendPrintf(Target, "
\n", align); - while ((n = StrBufSipLine(Line, Source, &BufPtr), n >= 0) && !done) - { - done = n == 0; - bq = 0; - i = 0; - ptr = ChrPtr(Line); - len = StrLength(Line); - pte = ptr + len; - - if ((intext == 1) && (isspace(*ptr))) { - StrBufAppendBufPlain(Target, HKEY("
"), 0); - } - intext = 1; - if (isspace(*ptr)) while ((ptr < pte) && - ((*ptr == '>') || - isspace(*ptr))) + + if (StrLength(Source) > 0) + do { - if (*ptr == '>') - bq++; - ptr ++; - i++; - } + StrBufSipLine(Line, Source, &BufPtr); + bq = 0; + i = 0; + ptr = ChrPtr(Line); + len = StrLength(Line); + pte = ptr + len; - /** - * Quoted text should be displayed in italics and in a - * different colour. This code understands Citadel-style - * " >" quotes and will convert to
tags. - */ - if (i > 0) StrBufCutLeft(Line, i); + if ((intext == 1) && (isspace(*ptr))) { + StrBufAppendBufPlain(Target, HKEY("
"), 0); + } + intext = 1; + if (isspace(*ptr)) while ((ptr < pte) && + ((*ptr == '>') || + isspace(*ptr))) + { + if (*ptr == '>') + bq++; + ptr ++; + i++; + } + + /** + * Quoted text should be displayed in italics and in a + * different colour. This code understands Citadel-style + * " >" quotes and will convert to
tags. + */ + if (i > 0) StrBufCutLeft(Line, i); - for (i = bn; i < bq; i++) - StrBufAppendBufPlain(Target, HKEY("
"), 0); - for (i = bq; i < bn; i++) - StrBufAppendBufPlain(Target, HKEY("
"), 0); - bn = bq; + for (i = bn; i < bq; i++) + StrBufAppendBufPlain(Target, HKEY("
"), 0); + for (i = bq; i < bn; i++) + StrBufAppendBufPlain(Target, HKEY("
"), 0); + bn = bq; - if (StrLength(Line) == 0) - continue; - /** Activate embedded URL's */ - UrlizeText(Line1, Line, Line2); + if (StrLength(Line) == 0) + continue; + /** Activate embedded URL's */ + UrlizeText(Line1, Line, Line2); - StrEscAppend(Target, Line1, NULL, 0, 0); + StrEscAppend(Target, Line1, NULL, 0, 0); + + StrBufAppendBufPlain(Target, HKEY("\n"), 0); + } + while ((BufPtr != StrBufNOTNULL) && + (BufPtr != NULL)); - StrBufAppendBufPlain(Target, HKEY("\n"), 0); - } for (i = 0; i < bn; i++) StrBufAppendBufPlain(Target, HKEY("
"), 0); StrBufAppendBufPlain(Target, HKEY("

\n"), 0);