summaryrefslogtreecommitdiffabout
path: root/html.c
authorLars Hjemli <hjemli@gmail.com>2008-09-01 20:40:24 (UTC)
committer Lars Hjemli <hjemli@gmail.com>2008-09-01 20:40:24 (UTC)
commit288d502b3d8e7fa916104b486bbb146521e5c716 (patch) (unidiff)
treeafa132f6c973ab30e0b8ed1201fb691fe91103c0 /html.c
parent2cecf839a06ce951db0d5d95abf79004eff33ca7 (diff)
parent02a545e63454530c1639014d3239c14ced2022c6 (diff)
downloadcgit-288d502b3d8e7fa916104b486bbb146521e5c716.zip
cgit-288d502b3d8e7fa916104b486bbb146521e5c716.tar.gz
cgit-288d502b3d8e7fa916104b486bbb146521e5c716.tar.bz2
Merge branch 'lh/clone'
* lh/clone: Add support for cloning over http Conflicts: cmd.c
Diffstat (limited to 'html.c') (more/less context) (ignore whitespace changes)
-rw-r--r--html.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/html.c b/html.c
index bddb04d..1237076 100644
--- a/html.c
+++ b/html.c
@@ -42,24 +42,31 @@ void html(const char *txt)
42 42
43void htmlf(const char *format, ...) 43void htmlf(const char *format, ...)
44{ 44{
45 static char buf[65536]; 45 static char buf[65536];
46 va_list args; 46 va_list args;
47 47
48 va_start(args, format); 48 va_start(args, format);
49 vsnprintf(buf, sizeof(buf), format, args); 49 vsnprintf(buf, sizeof(buf), format, args);
50 va_end(args); 50 va_end(args);
51 html(buf); 51 html(buf);
52} 52}
53 53
54void html_status(int code, int more_headers)
55{
56 htmlf("Status: %d\n", code);
57 if (!more_headers)
58 html("\n");
59}
60
54void html_txt(char *txt) 61void html_txt(char *txt)
55{ 62{
56 char *t = txt; 63 char *t = txt;
57 while(t && *t){ 64 while(t && *t){
58 int c = *t; 65 int c = *t;
59 if (c=='<' || c=='>' || c=='&') { 66 if (c=='<' || c=='>' || c=='&') {
60 write(htmlfd, txt, t - txt); 67 write(htmlfd, txt, t - txt);
61 if (c=='>') 68 if (c=='>')
62 html("&gt;"); 69 html("&gt;");
63 else if (c=='<') 70 else if (c=='<')
64 html("&lt;"); 71 html("&lt;");
65 else if (c=='&') 72 else if (c=='&')