From 065c7fdfab3182e5d5117a4c11b71eca40b70e12 Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Thu, 10 Mar 2011 19:27:41 +0100 Subject: [PATCH] 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. --- parser.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) 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() -- 1.7.0.4