summaryrefslogtreecommitdiff
path: root/sys/src/cmd/tcs/html.c
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@centraldogma>2011-09-20 00:37:06 +0200
committercinap_lenrek <cinap_lenrek@centraldogma>2011-09-20 00:37:06 +0200
commite7df0daa66531eccb2d37f7b66e27d16c9ae4391 (patch)
treeebafd5367cbfb29da96570de0d2fca9de22a3110 /sys/src/cmd/tcs/html.c
parent19070c5ce5da71967eb3938b26991b1fda19e3fe (diff)
tcs: use character set alias names from abaco, more tolerant html entity support
Diffstat (limited to 'sys/src/cmd/tcs/html.c')
-rw-r--r--sys/src/cmd/tcs/html.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/sys/src/cmd/tcs/html.c b/sys/src/cmd/tcs/html.c
index 93bd9e5ad..98386e8d6 100644
--- a/sys/src/cmd/tcs/html.c
+++ b/sys/src/cmd/tcs/html.c
@@ -404,24 +404,25 @@ html_in(int fd, long *x, struct convert *out)
c = Bgetc(&b);
if(c == Beof)
break;
- buf[i++] = c;
- if(strchr("; \t\r\n", c))
+ if(strchr(";&</> \t\r\n", c)){
+ if(c != ';')
+ Bungetc(&b);
break;
+ }
+ buf[i++] = c;
}
buf[i] = 0;
- if(buf[i-1] == ';'){
- buf[i-1] = 0;
+ if(i > 1){
if((c = findbyname(buf+1)) != Runeerror){
*r++ = c;
continue;
}
- buf[i-1] = ';';
- if(buf[1] == '#'){
- if(buf[2] == 'x')
+ if(i > 2 && buf[1] == '#'){
+ if(i > 3 && strchr("xX", buf[2]))
c = strtol(buf+3, &p, 16);
else
c = strtol(buf+2, &p, 10);
- if(*p != ';' || c >= NRUNE || c < 0)
+ if(*p || c >= NRUNE || c < 0)
goto bad;
*r++ = c;
continue;