Signed-off-by: Lars Hjemli <hjemli@gmail.com>
This commit is contained in:
Hiroki Hattori 2008-02-24 02:57:34 +09:00 zatwierdzone przez Lars Hjemli
rodzic b74cc91574
commit eacde43d71

20
html.c
Wyświetl plik

@ -48,9 +48,7 @@ void html_txt(char *txt)
while(t && *t){ while(t && *t){
int c = *t; int c = *t;
if (c=='<' || c=='>' || c=='&') { if (c=='<' || c=='>' || c=='&') {
*t = '\0'; write(htmlfd, txt, t - txt);
html(txt);
*t = c;
if (c=='>') if (c=='>')
html("&gt;"); html("&gt;");
else if (c=='<') else if (c=='<')
@ -71,9 +69,7 @@ void html_ntxt(int len, char *txt)
while(t && *t && len--){ while(t && *t && len--){
int c = *t; int c = *t;
if (c=='<' || c=='>' || c=='&') { if (c=='<' || c=='>' || c=='&') {
*t = '\0'; write(htmlfd, txt, t - txt);
html(txt);
*t = c;
if (c=='>') if (c=='>')
html("&gt;"); html("&gt;");
else if (c=='<') else if (c=='<')
@ -84,12 +80,8 @@ void html_ntxt(int len, char *txt)
} }
t++; t++;
} }
if (t!=txt) { if (t!=txt)
char c = *t; write(htmlfd, txt, t - txt);
*t = '\0';
html(txt);
*t = c;
}
if (len<0) if (len<0)
html("..."); html("...");
} }
@ -100,9 +92,7 @@ void html_attr(char *txt)
while(t && *t){ while(t && *t){
int c = *t; int c = *t;
if (c=='<' || c=='>' || c=='\'') { if (c=='<' || c=='>' || c=='\'') {
*t = '\0'; write(htmlfd, txt, t - txt);
html(txt);
*t = c;
if (c=='>') if (c=='>')
html("&gt;"); html("&gt;");
else if (c=='<') else if (c=='<')