diff options
author | cinap_lenrek <cinap_lenrek@gmx.de> | 2012-08-15 13:15:34 +0200 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@gmx.de> | 2012-08-15 13:15:34 +0200 |
commit | 39321532992f0705f662fd63e93186da309c3a47 (patch) | |
tree | 8ee85b0632599a7510c4099866a81e5f590c8d79 | |
parent | 21b5efe9627ea59b06015f5229c069f346535704 (diff) |
mothra: handle misplaced trailing quotes
-rw-r--r-- | sys/src/cmd/mothra/rdhtml.c | 5 | ||||
-rw-r--r-- | sys/src/cmd/uhtml.c | 11 |
2 files changed, 12 insertions, 4 deletions
diff --git a/sys/src/cmd/mothra/rdhtml.c b/sys/src/cmd/mothra/rdhtml.c index 7bcf7367b..32b327aff 100644 --- a/sys/src/cmd/mothra/rdhtml.c +++ b/sys/src/cmd/mothra/rdhtml.c @@ -487,8 +487,11 @@ int pl_gettag(Hglob *g){ q = c; else if(q == c) q = 0; - } else if(c == ETAG && q != '\'' && q != '"') + } + else if(c == ETAG && q != '\'' && q != '"') break; + else if(q == '=' && c != ' ' && c != '\t' && c != '\n') + q = 0; if(tokp < &g->token[NTOKEN-UTFmax-1]) tokp += lrunetochar(tokp, c); } diff --git a/sys/src/cmd/uhtml.c b/sys/src/cmd/uhtml.c index 9d7ef4422..7c612de9e 100644 --- a/sys/src/cmd/uhtml.c +++ b/sys/src/cmd/uhtml.c @@ -104,15 +104,20 @@ main(int argc, char *argv[]) g = ++s; e = buf+nbuf; while(s < e){ - if(*s == '\'' || *s == '"'){ - if(q == 0) + if(*s == '=' && q == 0) + q = '='; + else if(*s == '\'' || *s == '"'){ + if(q == '=') q = *s; else if(q == *s) q = 0; - } else if(*s == '>' && q == 0){ + } + else if(*s == '>' && q != '\'' && q != '"'){ e = s; break; } + else if(q == '=' && strchr(whitespace, *s) == nil) + q = 0; s++; } t = *e; |