summaryrefslogtreecommitdiffabout
path: root/html.c
authorLars Hjemli <hjemli@gmail.com>2008-10-05 11:13:33 (UTC)
committer Lars Hjemli <hjemli@gmail.com>2008-10-05 11:13:33 (UTC)
commit20c895f6889a66d7cf43c67a7c22df6ef324ed5d (patch) (side-by-side diff)
tree4fc0c044fa0919cab562b371191add67114d07a9 /html.c
parent204669ff4a4028a82cc48e9319632595ba3ff703 (diff)
parentb575115d9d93e45cdbcd5d066cc445d34639ae6a (diff)
downloadcgit-20c895f6889a66d7cf43c67a7c22df6ef324ed5d.zip
cgit-20c895f6889a66d7cf43c67a7c22df6ef324ed5d.tar.gz
cgit-20c895f6889a66d7cf43c67a7c22df6ef324ed5d.tar.bz2
Merge branch 'lh/escape-urls'
* lh/escape-urls: ui-shared.c: use html_url_arg() html.c: add html_url_arg
Diffstat (limited to 'html.c') (more/less context) (show whitespace changes)
-rw-r--r--html.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/html.c b/html.c
index 36e9a2f..167127f 100644
--- a/html.c
+++ b/html.c
@@ -130,2 +130,18 @@ void html_attr(char *txt)
+void html_url_arg(char *txt)
+{
+ char *t = txt;
+ while(t && *t){
+ int c = *t;
+ if (c=='"' || c=='#' || c=='%' || c=='&' || c=='\'' || c=='+' || c=='?') {
+ write(htmlfd, txt, t - txt);
+ write(htmlfd, fmt("%%%2x", c), 3);
+ txt = t+1;
+ }
+ t++;
+ }
+ if (t!=txt)
+ html(txt);
+}
+
void html_hidden(char *name, char *value)