diff options
Diffstat (limited to 'html.c')
| -rw-r--r-- | html.c | 28 |
1 files changed, 28 insertions, 0 deletions
| @@ -65,6 +65,34 @@ void html_txt(char *txt) | |||
| 65 | html(txt); | 65 | html(txt); |
| 66 | } | 66 | } |
| 67 | 67 | ||
| 68 | void 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(">"); | ||
| 79 | else if (c=='<') | ||
| 80 | html("<"); | ||
| 81 | else if (c=='&') | ||
| 82 | html("&"); | ||
| 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 | ||
| 69 | void html_attr(char *txt) | 97 | void html_attr(char *txt) |
| 70 | { | 98 | { |
