tcs: fix UTF-near-EOF bug and add TUNE encoding
[rsc] --rw-rw-r-- M 22963 glenda sys 7975 Mar 29 17:57 sys/src/cmd/tcs/utf.c
/n/sourcesdump/2006/0329/plan9/sys/src/cmd/tcs/utf.c:37,43 -
/n/sourcesdump/2006/0330/plan9/sys/src/cmd/tcs/utf.c:37,43
tot = 0;
while((n = read(fd, buf+tot, N-tot)) >= 0){
tot += n;
- for(i=j=0; i<tot; ){
+ for(i=j=0; i<tot-UTFmax || (n==0 && i<tot); ){
c = our_mbtowc(&l, buf+i, tot-i);
if(c == -1){
if(squawk)
/n/sourcesdump/2006/0329/plan9/sys/src/cmd/tcs/utf.c:61,66 -
/n/sourcesdump/2006/0330/plan9/sys/src/cmd/tcs/utf.c:61,67
if(n == 0)
break;
}
+ OUT(out, runes, 0);
}
void
/n/sourcesdump/2006/0329/plan9/sys/src/cmd/tcs/utf.c:112,117 -
/n/sourcesdump/2006/0330/plan9/sys/src/cmd/tcs/utf.c:113,119
if(n == 0)
break;
}
+ OUT(out, runes, 0);
}
void
|