From 98aa02bda540f17f1f50be00e494efafe439b004 Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Sat, 10 Oct 2009 08:34:10 -0700 Subject: [PATCH] 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. --- backend.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) 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) } } -- 1.7.0.4