diff options
Diffstat (limited to 'html.c')
| -rw-r--r-- | html.c | 20 |
1 files changed, 5 insertions, 15 deletions
| @@ -56,9 +56,7 @@ void html_txt(char *txt) | |||
| 56 | while(t && *t){ | 56 | while(t && *t){ |
| 57 | int c = *t; | 57 | int c = *t; |
| 58 | if (c=='<' || c=='>' || c=='&') { | 58 | if (c=='<' || c=='>' || c=='&') { |
| 59 | *t = '\0'; | 59 | write(htmlfd, txt, t - txt); |
| 60 | html(txt); | ||
| 61 | *t = c; | ||
| 62 | if (c=='>') | 60 | if (c=='>') |
| 63 | html(">"); | 61 | html(">"); |
| 64 | else if (c=='<') | 62 | else if (c=='<') |
| @@ -79,9 +77,7 @@ void html_ntxt(int len, char *txt) | |||
| 79 | while(t && *t && len--){ | 77 | while(t && *t && len--){ |
| 80 | int c = *t; | 78 | int c = *t; |
| 81 | if (c=='<' || c=='>' || c=='&') { | 79 | if (c=='<' || c=='>' || c=='&') { |
| 82 | *t = '\0'; | 80 | write(htmlfd, txt, t - txt); |
| 83 | html(txt); | ||
| 84 | *t = c; | ||
| 85 | if (c=='>') | 81 | if (c=='>') |
| 86 | html(">"); | 82 | html(">"); |
| 87 | else if (c=='<') | 83 | else if (c=='<') |
| @@ -92,12 +88,8 @@ void html_ntxt(int len, char *txt) | |||
| 92 | } | 88 | } |
| 93 | t++; | 89 | t++; |
| 94 | } | 90 | } |
| 95 | if (t!=txt) { | 91 | if (t!=txt) |
| 96 | char c = *t; | 92 | write(htmlfd, txt, t - txt); |
| 97 | *t = '\0'; | ||
| 98 | html(txt); | ||
| 99 | *t = c; | ||
| 100 | } | ||
| 101 | if (len<0) | 93 | if (len<0) |
| 102 | html("..."); | 94 | html("..."); |
| 103 | } | 95 | } |
| @@ -108,9 +100,7 @@ void html_attr(char *txt) | |||
| 108 | while(t && *t){ | 100 | while(t && *t){ |
| 109 | int c = *t; | 101 | int c = *t; |
| 110 | if (c=='<' || c=='>' || c=='\'') { | 102 | if (c=='<' || c=='>' || c=='\'') { |
| 111 | *t = '\0'; | 103 | write(htmlfd, txt, t - txt); |
| 112 | html(txt); | ||
| 113 | *t = c; | ||
| 114 | if (c=='>') | 104 | if (c=='>') |
| 115 | html(">"); | 105 | html(">"); |
| 116 | else if (c=='<') | 106 | else if (c=='<') |
