X-Git-Url: https://gitweb.ps.run/ps-cgit/blobdiff_plain/60fcf600f5010701c20b63867999a802ca0e05c0..fe1bb0e765883fa4149fba12daee81b6ae070de3:/html.c
diff --git a/html.c b/html.c
index 337baeb..8f6e4f6 100644
--- a/html.c
+++ b/html.c
@@ -95,7 +95,7 @@ void html_txt(const char *txt)
while(t && *t){
int c = *t;
if (c=='<' || c=='>' || c=='&') {
- write(htmlfd, txt, t - txt);
+ html_raw(txt, t - txt);
if (c=='>')
html(">");
else if (c=='<')
@@ -116,7 +116,7 @@ void html_ntxt(int len, const char *txt)
while(t && *t && len--){
int c = *t;
if (c=='<' || c=='>' || c=='&') {
- write(htmlfd, txt, t - txt);
+ html_raw(txt, t - txt);
if (c=='>')
html(">");
else if (c=='<')
@@ -128,7 +128,7 @@ void html_ntxt(int len, const char *txt)
t++;
}
if (t!=txt)
- write(htmlfd, txt, t - txt);
+ html_raw(txt, t - txt);
if (len<0)
html("...");
}
@@ -138,8 +138,8 @@ void html_attr(const char *txt)
const char *t = txt;
while(t && *t){
int c = *t;
- if (c=='<' || c=='>' || c=='\'' || c=='\"') {
- write(htmlfd, txt, t - txt);
+ if (c=='<' || c=='>' || c=='\'' || c=='\"' || c=='&') {
+ html_raw(txt, t - txt);
if (c=='>')
html(">");
else if (c=='<')
@@ -148,6 +148,8 @@ void html_attr(const char *txt)
html("'");
else if (c=='"')
html(""");
+ else if (c=='&')
+ html("&");
txt = t+1;
}
t++;
@@ -160,11 +162,11 @@ void html_url_path(const char *txt)
{
const char *t = txt;
while(t && *t){
- int c = *t;
+ unsigned char c = *t;
const char *e = url_escape_table[c];
- if (e && c!='+' && c!='&' && c!='+') {
- write(htmlfd, txt, t - txt);
- write(htmlfd, e, 3);
+ if (e && c!='+' && c!='&') {
+ html_raw(txt, t - txt);
+ html(e);
txt = t+1;
}
t++;
@@ -177,11 +179,13 @@ void html_url_arg(const char *txt)
{
const char *t = txt;
while(t && *t){
- int c = *t;
+ unsigned char c = *t;
const char *e = url_escape_table[c];
+ if (c == ' ')
+ e = "+";
if (e) {
- write(htmlfd, txt, t - txt);
- write(htmlfd, e, 3);
+ html_raw(txt, t - txt);
+ html(e);
txt = t+1;
}
t++;
@@ -211,6 +215,14 @@ void html_option(const char *value, const char *text, const char *selected_value
html("\n");
}
+void html_intoption(int value, const char *text, int selected_value)
+{
+ htmlf("");
+}
+
void html_link_open(const char *url, const char *title, const char *class)
{
html("