From: H.G. Muller Date: Sat, 10 Oct 2009 15:34:10 +0000 (-0700) Subject: fix joining of lines split by ICS X-Git-Tag: v4.4.1.20091019~42 X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=98aa02bda540f17f1f50be00e494efafe439b004;p=xboard.git fix joining of lines split by ICS This patch fixes the joining of lines that were split by an ICS, so that adding a space at the break point is done only when there was not a space already. (Some ICS leave a space at the end of the broken line, others do not.) An extra space would interefere with board12 in Gothic Chess, which is so long that the ICS breaks it, and the WB parser could not handle a double space within the board. --- diff --git a/backend.c b/backend.c index 3605468..a612db1 100644 --- a/backend.c +++ b/backend.c @@ -2124,7 +2124,8 @@ read_from_ics(isr, closure, data, count, error) if(buf_len >= 5 && buf[buf_len-5]=='\n' && buf[buf_len-4]=='\\' && buf[buf_len-3]==' ' && buf[buf_len-2]==' ' && buf[buf_len-1]==' ') { buf_len -= 5; // [HGM] ICS: join continuation line of Lasker 2.2.3 server with previous - buf[buf_len++] = ' '; // replace by space (assumes ICS does not break lines within word) + if(buf_len == 0 || buf[buf_len-1] != ' ') + buf[buf_len++] = ' '; // add space (assumes ICS does not break lines within word) } }