static char buf[BUF_SIZE + 1];
static int firstTime = TRUE, intfSet = FALSE;
static ColorClass prevColor = ColorNormal;
- static int savingComment = FALSE;\r
- static int cmatch = 0; // continuation sequence match\r
- char *bp;
+ static int savingComment = FALSE;
+ static int cmatch = 0; // continuation sequence match
+ char *bp;
char str[500];
int i, oldi;
int buf_len;
buf[i] = buf[leftover_start + i];
}
- /* copy new characters into the buffer */\r
- bp = buf + leftover_len;\r
- buf_len=leftover_len;\r
- for (i=0; i<count; i++)\r
- {\r
- // ignore these\r
- if (data[i] == '\r')\r
- continue;\r
-\r
- // join lines split by ICS?\r
- if (!appData.noJoin)\r
- {\r
- /*\r
- Joining just consists of finding matches against the\r
- continuation sequence, and discarding that sequence\r
- if found instead of copying it. So, until a match\r
- fails, there's nothing to do since it might be the\r
- complete sequence, and thus, something we don't want\r
- copied.\r
- */\r
- if (data[i] == cont_seq[cmatch])\r
- {\r
- cmatch++;\r
- if (cmatch == strlen(cont_seq))\r
- cmatch = 0; // complete match. just reset the counter\r
- continue;\r
- }\r
- else if (cmatch)\r
- {\r
- /*\r
- match failed, so we have to copy what matched before\r
- falling through and copying this character. In reality,\r
- this will only ever be just the newline character, but\r
- it doesn't hurt to be precise.\r
- */\r
- strncpy(bp, cont_seq, cmatch);\r
- bp += cmatch;\r
- buf_len += cmatch;\r
- cmatch = 0;\r
- }\r
- }\r
-\r
- // copy this char\r
- *bp++ = data[i];\r
- buf_len++;\r
- }\r
-\r
+ /* copy new characters into the buffer */
+ bp = buf + leftover_len;
+ buf_len=leftover_len;
+ for (i=0; i<count; i++)
+ {
+ // ignore these
+ if (data[i] == '\r')
+ continue;
+
+ // join lines split by ICS?
+ if (!appData.noJoin)
+ {
+ /*
+ Joining just consists of finding matches against the
+ continuation sequence, and discarding that sequence
+ if found instead of copying it. So, until a match
+ fails, there's nothing to do since it might be the
+ complete sequence, and thus, something we don't want
+ copied.
+ */
+ if (data[i] == cont_seq[cmatch])
+ {
+ cmatch++;
+ if (cmatch == strlen(cont_seq))
+ {
+ cmatch = 0; // complete match. just reset the counter
+
+ /*
+ it's possible for the ICS to not include the space
+ at the end of the last word, making our [correct]
+ join operation fuse two separate words. the server
+ does this when the space occurs at the width setting.
+ */
+ if (!buf_len || buf[buf_len-1] != ' ')
+ {
+ *bp++ = ' ';
+ buf_len++;
+ }
+ }
+ continue;
+ }
+ else if (cmatch)
+ {
+ /*
+ match failed, so we have to copy what matched before
+ falling through and copying this character. In reality,
+ this will only ever be just the newline character, but
+ it doesn't hurt to be precise.
+ */
+ strncpy(bp, cont_seq, cmatch);
+ bp += cmatch;
+ buf_len += cmatch;
+ cmatch = 0;
+ }
+ }
+
+ // copy this char
+ *bp++ = data[i];
+ buf_len++;
+ }
+
buf[buf_len] = NULLCHAR;
next_out = leftover_len;
leftover_start = 0;