avoid hang with htmlroff (Michael Teichgräber)
diff --git a/src/cmd/tcs/utf.c b/src/cmd/tcs/utf.c
index f87a310..4045332 100644
--- a/src/cmd/tcs/utf.c
+++ b/src/cmd/tcs/utf.c
@@ -45,7 +45,7 @@
 	tot = 0;
 	while((n = read(fd, buf+tot, N-tot)) >= 0){
 		tot += n;
-		for(i=j=0; i<tot-UTFmax || (n==0 && i<tot); ){
+		for(i=j=0; i<=tot-UTFmax || (i<tot && (n==0 || fullrune(buf+i, tot-i))); ){
 			c = our_mbtowc(&l, buf+i, tot-i);
 			if(c == -1){
 				if(squawk)