X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=parser.l;h=348bd1599b30e44157614a66e0d17bcc8c2f7b5c;hb=d6a5884d9a6af414ed26d5b70a1b3dcf131b1e9c;hp=8e3d397a1b6fefe7f76b1a7f792f2b3ad7003c69;hpb=60876535e02fb87e638a0aa94aa80490093099fc;p=xboard.git diff --git a/parser.l b/parser.l index 8e3d397..348bd15 100644 --- a/parser.l +++ b/parser.l @@ -1085,10 +1085,10 @@ int yywrap() /* Parse a move from the given string s */ /* ^ at start of pattern WON'T work here unless using flex */ -ChessMove yylexstr(boardIndex, s) - int boardIndex; - char *s; -{ +ChessMove yylexstr(boardIndex, s, text, len) + int boardIndex, len; + char *s, *text; +{ ChessMove ret; char *oldStringToLex; #ifdef FLEX_SCANNER @@ -1104,7 +1104,9 @@ ChessMove yylexstr(boardIndex, s) yy_switch_to_buffer(buffer); #endif /*FLEX_SCANNER*/ - ret = (ChessMove) yylex(); + ret = (ChessMove) yylex(); + strncpy(text, yy_text, len-1); // [HGM] vari: yy_text is not available to caller after buffer switch ?!? + text[len-1] = NULLCHAR; #ifdef FLEX_SCANNER if (oldBuffer != NULL)