-rw-r--r-- | html.c | 20 |
1 files changed, 5 insertions, 15 deletions
@@ -47,11 +47,9 @@ void html_txt(char *txt) char *t = 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(">"); else if (c=='<') html("<"); @@ -70,11 +68,9 @@ void html_ntxt(int len, char *txt) char *t = 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(">"); else if (c=='<') html("<"); @@ -83,14 +79,10 @@ void html_ntxt(int len, char *txt) txt = t+1; } 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("..."); } @@ -99,11 +91,9 @@ void html_attr(char *txt) char *t = 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(">"); else if (c=='<') html("<"); |