From: H.G. Muller Date: Thu, 10 Mar 2011 18:27:41 +0000 (+0100) Subject: Implement yynewstr entry point in new parser X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=065c7fdfab3182e5d5117a4c11b71eca40b70e12;p=xboard.git Implement yynewstr entry point in new parser This entry point, used for parsing an ICS move list, was forgotten, and was still an empty routine. This made XBoard crash when observing an ICS game. --- diff --git a/parser.c b/parser.c index 407b92e..973d109 100644 --- a/parser.c +++ b/parser.c @@ -44,6 +44,7 @@ int ReadLine() { // Read one line from the input file, and append to the buffer char c, *start = inPtr; if(fromString) return 0; // parsing string, so the end is a hard end + if(!inputFile) return 0; while((c = fgetc(inputFile)) != EOF) { *inPtr++ = c; if(c == '\n') { *inPtr = NULLCHAR; return 1; } @@ -521,12 +522,16 @@ void yynewfile (FILE *f) { // prepare parse buffer for reading file inputFile = f; inPtr = parsePtr = inputBuf; + fromString = 0; lastChar = '\n'; *inPtr = NULLCHAR; // make sure we will start by reading a line } void yynewstr P((char *s)) { + parsePtr = s; + inputFile = NULL; + fromString = 1; } int yylex()