mothra: handle misplaced trailing quotes

This commit is contained in:
cinap_lenrek 2012-08-15 13:15:34 +02:00
parent 21b5efe962
commit 3932153299
2 changed files with 12 additions and 4 deletions

View file

@ -487,8 +487,11 @@ int pl_gettag(Hglob *g){
q = c; q = c;
else if(q == c) else if(q == c)
q = 0; q = 0;
} else if(c == ETAG && q != '\'' && q != '"') }
else if(c == ETAG && q != '\'' && q != '"')
break; break;
else if(q == '=' && c != ' ' && c != '\t' && c != '\n')
q = 0;
if(tokp < &g->token[NTOKEN-UTFmax-1]) if(tokp < &g->token[NTOKEN-UTFmax-1])
tokp += lrunetochar(tokp, c); tokp += lrunetochar(tokp, c);
} }

View file

@ -104,15 +104,20 @@ main(int argc, char *argv[])
g = ++s; g = ++s;
e = buf+nbuf; e = buf+nbuf;
while(s < e){ while(s < e){
if(*s == '\'' || *s == '"'){ if(*s == '=' && q == 0)
if(q == 0) q = '=';
else if(*s == '\'' || *s == '"'){
if(q == '=')
q = *s; q = *s;
else if(q == *s) else if(q == *s)
q = 0; q = 0;
} else if(*s == '>' && q == 0){ }
else if(*s == '>' && q != '\'' && q != '"'){
e = s; e = s;
break; break;
} }
else if(q == '=' && strchr(whitespace, *s) == nil)
q = 0;
s++; s++;
} }
t = *e; t = *e;