[Refdb-cvs] CVS: refdb/src tokenize.c,1.13.2.1,1.13.2.2
Status: Beta
Brought to you by:
mhoenicka
From: Markus H. <mho...@us...> - 2005-10-11 20:36:01
|
Update of /cvsroot/refdb/refdb/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8898/src Modified Files: Tag: Release_0_9_5_stable tokenize.c Log Message: link_tokenize(): take care of escaped quotes Index: tokenize.c =================================================================== RCS file: /cvsroot/refdb/refdb/src/tokenize.c,v retrieving revision 1.13.2.1 retrieving revision 1.13.2.2 diff -u -U2 -r1.13.2.1 -r1.13.2.2 --- tokenize.c 29 Jul 2005 21:15:44 -0000 1.13.2.1 +++ tokenize.c 11 Oct 2005 20:35:50 -0000 1.13.2.2 @@ -593,10 +593,23 @@ } } - else if (inbuffer[i] == '\'') { + else if (inbuffer[i] == '\'' && inbuffer[i-1] != '\\') { + char *end; /* printf("here1\n"); */ have_token = 1; ptr_sqltoken->type = 0; this_token = &inbuffer[i+1]; - endtoken = strchr(&inbuffer[i+1], (int)'\''); /* jump to next ' */ + end = this_token; + + /* loop until we find an unescaped matching end quote */ + while (end != NULL) { + endtoken = strchr(end, (int)'\''); /* jump to next ' */ + if (!endtoken || *(endtoken-1) != '\\') { + end = NULL; + } + else { + end = endtoken+1; + } + } + if (endtoken != NULL) { ptr_sqltoken->next_token = strstr(endtoken, " "); |