From: H.G.Muller Date: Tue, 10 Apr 2018 15:09:56 +0000 (+0200) Subject: Fix recognition of CECP 'level' command X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=f0f38d58e00c744e106c9c70e58d094f95cf9998;p=crazywa.git Fix recognition of CECP 'level' command As the sscanf to extract the TC parameters was attempting to match the initial keyword 'level' as well, while the first byte of the input buffer had already been zeroed to mark the command as processed, the 'level' command was completely ignored, and CrazyWa was always playing at its default TC of 40 moves / 5 min. --- diff --git a/dropper.c b/dropper.c index 6f12051..4bf5dff 100644 --- a/dropper.c +++ b/dropper.c @@ -1782,8 +1782,8 @@ printf("# command: %s\n", inBuf); if(!strcmp(command, "exit")) { engineSide = NONE; return 1; } if(!strcmp(command, "level")) { int min, sec=0; - sscanf(inBuf, "level %d %d %d", &mps, &min, &inc) == 3 || // if this does not work, it must be min:sec format - sscanf(inBuf, "level %d %d:%d %d", &mps, &min, &sec, &inc); + sscanf(inBuf+6, "%d %d %d", &mps, &min, &inc) == 3 || // if this does not work, it must be min:sec format + sscanf(inBuf+6, "%d %d:%d %d", &mps, &min, &sec, &inc); timeControl = 60*min + sec; timePerMove = -1; return 1; }