summaryrefslogtreecommitdiffabout
path: root/html.c
authorLars Hjemli <hjemli@gmail.com>2008-09-01 20:40:55 (UTC)
committer Lars Hjemli <hjemli@gmail.com>2008-09-01 20:40:55 (UTC)
commitd532c4d1612c94347427fa1afda6afb7c34e512a (patch) (side-by-side diff)
tree53f3f86ba8e78051bee96cb65a6219ef43d9adab /html.c
parent288d502b3d8e7fa916104b486bbb146521e5c716 (diff)
parent885096c189574b1cf2e0897cc05aadd7b092a677 (diff)
downloadcgit-d532c4d1612c94347427fa1afda6afb7c34e512a.zip
cgit-d532c4d1612c94347427fa1afda6afb7c34e512a.tar.gz
cgit-d532c4d1612c94347427fa1afda6afb7c34e512a.tar.bz2
Merge branch 'lh/plain'
* lh/plain: Supply status description to html_status() ui-tree: link to plain view instead of blob view Implement plain view
Diffstat (limited to 'html.c') (more/less context) (ignore whitespace changes)
-rw-r--r--html.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/html.c b/html.c
index 1237076..36e9a2f 100644
--- a/html.c
+++ b/html.c
@@ -26,43 +26,48 @@ char *fmt(const char *format, ...)
bufidx &= 7;
va_start(args, format);
len = vsnprintf(buf[bufidx], sizeof(buf[bufidx]), format, args);
va_end(args);
if (len>sizeof(buf[bufidx])) {
fprintf(stderr, "[html.c] string truncated: %s\n", format);
exit(1);
}
return buf[bufidx];
}
+void html_raw(const char *data, size_t size)
+{
+ write(htmlfd, data, size);
+}
+
void html(const char *txt)
{
write(htmlfd, txt, strlen(txt));
}
void htmlf(const char *format, ...)
{
static char buf[65536];
va_list args;
va_start(args, format);
vsnprintf(buf, sizeof(buf), format, args);
va_end(args);
html(buf);
}
-void html_status(int code, int more_headers)
+void html_status(int code, const char *msg, int more_headers)
{
- htmlf("Status: %d\n", code);
+ htmlf("Status: %d %s\n", code, msg);
if (!more_headers)
html("\n");
}
void html_txt(char *txt)
{
char *t = txt;
while(t && *t){
int c = *t;
if (c=='<' || c=='>' || c=='&') {
write(htmlfd, txt, t - txt);
if (c=='>')