git: 9front

Download patch

ref: 99658a7efac47adfaa9a90627209d62a7e7ef37c
parent: 7e704b4a1d2cc358ac4634f9a7329c8bb68acf0f
author: cinap_lenrek <cinap_lenrek@gmx.de>
date: Wed Aug 15 09:15:34 EDT 2012

mothra: handle misplaced trailing quotes

--- a/sys/src/cmd/mothra/rdhtml.c
+++ b/sys/src/cmd/mothra/rdhtml.c
@@ -487,8 +487,11 @@
 				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);
 	}
--- a/sys/src/cmd/uhtml.c
+++ b/sys/src/cmd/uhtml.c
@@ -104,15 +104,20 @@
 			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;
--