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.
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)
}
}