[Goodies-commits] r5695 - xfce4-dict/trunk/lib
Enrico Troeger
enrico at xfce.org
Sun Oct 19 11:29:55 CEST 2008
Author: enrico
Date: 2008-10-19 09:29:55 +0000 (Sun, 19 Oct 2008)
New Revision: 5695
Modified:
xfce4-dict/trunk/lib/dictd.c
Log:
Handle trailing period in text responses accordingly to RFC 2229.
Modified: xfce4-dict/trunk/lib/dictd.c
===================================================================
--- xfce4-dict/trunk/lib/dictd.c 2008-10-19 09:29:52 UTC (rev 5694)
+++ xfce4-dict/trunk/lib/dictd.c 2008-10-19 09:29:55 UTC (rev 5695)
@@ -221,8 +221,19 @@
/* all following lines represents the translation */
i += 2; /* skip the next two lines */
- while (lines[i] != NULL && lines[i][0] != '.' && lines[i][0] != '\r' && lines[i][0] != '\n')
+ while (lines[i] != NULL && lines[i][0] != '\r' && lines[i][0] != '\n')
{
+ /* check for a leading period indicating end of text response */
+ if (lines[i][0] == '.')
+ {
+ /* a double period at line start is a masked period, cf. RFC 2229 */
+ if (strlen(lines[i]) > 1 && lines[i][1] == '.')
+ /* the RFC says we should coolapse the two periods into one but we go the
+ * lazy way and simply replace the first period by a space */
+ lines[i][0] = ' ';
+ else
+ break; /* we reached the end of the test response */
+ }
stripped = g_strstrip(lines[i]);
if (strlen(stripped) > 0)
{
More information about the Goodies-commits
mailing list