aboutsummaryrefslogtreecommitdiff
diff refs
from: back
to: back
| flip
diff options
context:
space:
mode:
-rw-r--r--html.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/html.c b/html.c
index 339bf00..eb163d9 100644
--- a/html.c
+++ b/html.c
@@ -48,7 +48,9 @@ void html_txt(char *txt)
while(t && *t){
int c = *t;
if (c=='<' || c=='>' || c=='&') {
- write(htmlfd, txt, t - txt);
+ *t = '\0';
+ html(txt);
+ *t = c;
if (c=='>')
html("&gt;");
else if (c=='<')
@@ -69,7 +71,9 @@ void html_ntxt(int len, char *txt)
while(t && *t && len--){
int c = *t;
if (c=='<' || c=='>' || c=='&') {
- write(htmlfd, txt, t - txt);
+ *t = '\0';
+ html(txt);
+ *t = c;
if (c=='>')
html("&gt;");
else if (c=='<')
@@ -80,8 +84,12 @@ void html_ntxt(int len, char *txt)
}
t++;
}
- if (t!=txt)
- write(htmlfd, txt, t - txt);
+ if (t!=txt) {
+ char c = *t;
+ *t = '\0';
+ html(txt);
+ *t = c;
+ }
if (len<0)
html("...");
}
@@ -92,7 +100,9 @@ void html_attr(char *txt)
while(t && *t){
int c = *t;
if (c=='<' || c=='>' || c=='\'') {
- write(htmlfd, txt, t - txt);
+ *t = '\0';
+ html(txt);
+ *t = c;
if (c=='>')
html("&gt;");
else if (c=='<')