about summary refs log tree commit diff
path: root/html.c
diff options
context:
space:
mode:
Diffstat (limited to 'html.c')
-rw-r--r--html.c20
1 files changed, 5 insertions, 15 deletions
diff --git a/html.c b/html.c
index 98ffaf9..937b5e7 100644
--- a/html.c
+++ b/html.c
@@ -56,9 +56,7 @@ void html_txt(char *txt)
 	while(t && *t){
 		int c = *t;
 		if (c=='<' || c=='>' || c=='&') {
-			*t = '\0';
-			html(txt);
-			*t = c;
+			write(htmlfd, txt, t - txt);
 			if (c=='>')
 				html("&gt;");
 			else if (c=='<')
@@ -79,9 +77,7 @@ void html_ntxt(int len, char *txt)
 	while(t && *t && len--){
 		int c = *t;
 		if (c=='<' || c=='>' || c=='&') {
-			*t = '\0';
-			html(txt);
-			*t = c;
+			write(htmlfd, txt, t - txt);
 			if (c=='>')
 				html("&gt;");
 			else if (c=='<')
@@ -92,12 +88,8 @@ void html_ntxt(int len, char *txt)
 		}
 		t++;
 	}
-	if (t!=txt) {
-		char c = *t;
-		*t = '\0';
-		html(txt);
-		*t = c;
-	}
+	if (t!=txt)
+		write(htmlfd, txt, t - txt);
 	if (len<0)
 		html("...");
 }
@@ -108,9 +100,7 @@ void html_attr(char *txt)
 	while(t && *t){
 		int c = *t;
 		if (c=='<' || c=='>' || c=='\'') {
-			*t = '\0';
-			html(txt);
-			*t = c;
+			write(htmlfd, txt, t - txt);
 			if (c=='>')
 				html("&gt;");
 			else if (c=='<')