aboutsummaryrefslogtreecommitdiff
path: root/html.c
diff options
context:
space:
mode:
authorLars Hjemli <hjemli@gmail.com>2007-05-18 23:56:10 +0200
committerLars Hjemli <hjemli@gmail.com>2007-05-18 23:56:10 +0200
commit5e75128a8bee885d83563d8c521172328d511d12 (patch)
tree39e32199b06b6e68782040d5c2a46162fb0cf771 /html.c
parent08cc2e5f0e24773dad81d38bd6b689e36afe9dda (diff)
downloadcgit-5e75128a8bee885d83563d8c521172328d511d12.tar.gz
cgit-5e75128a8bee885d83563d8c521172328d511d12.tar.bz2
cgit-5e75128a8bee885d83563d8c521172328d511d12.zip
Add html_include()
This is a function used to include external htmlfiles in cgit- generated pages. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Diffstat (limited to 'html.c')
-rw-r--r--html.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/html.c b/html.c
index 175b4b6..33a956f 100644
--- a/html.c
+++ b/html.c
@@ -166,3 +166,17 @@ void html_filemode(unsigned short mode)
html_fileperm(mode >> 3);
html_fileperm(mode);
}
+
+int html_include(const char *filename)
+{
+ FILE *f;
+ char buf[4096];
+ size_t len;
+
+ if (!(f = fopen(filename, "r")))
+ return -1;
+ while((len = fread(buf, 1, 4096, f)) > 0)
+ write(htmlfd, buf, len);
+ fclose(f);
+ return 0;
+}