summaryrefslogtreecommitdiffabout
path: root/html.c
Unidiff
Diffstat (limited to 'html.c') (more/less context) (ignore whitespace changes)
-rw-r--r--html.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/html.c b/html.c
index 8a69659..957b326 100644
--- a/html.c
+++ b/html.c
@@ -65,6 +65,34 @@ void html_txt(char *txt)
65 html(txt); 65 html(txt);
66} 66}
67 67
68void html_ntxt(int len, char *txt)
69{
70 char *t = txt;
71 while(*t && len--){
72 int c = *t;
73 if (c=='<' || c=='>' || c=='&') {
74 *t = '\0';
75 html(txt);
76 *t = c;
77 if (c=='>')
78 html("&gt;");
79 else if (c=='<')
80 html("&lt;");
81 else if (c=='&')
82 html("&amp;");
83 txt = t+1;
84 }
85 t++;
86 }
87 if (t!=txt) {
88 char c = *t;
89 *t = '\0';
90 html(txt);
91 *t = c;
92 }
93 if (len<0)
94 html("...");
95}
68 96
69void html_attr(char *txt) 97void html_attr(char *txt)
70{ 98{