author | Lars Hjemli <hjemli@gmail.com> | 2007-05-18 21:56:10 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2007-05-18 21:56:10 (UTC) |
commit | 5e75128a8bee885d83563d8c521172328d511d12 (patch) (side-by-side diff) | |
tree | 39e32199b06b6e68782040d5c2a46162fb0cf771 | |
parent | 08cc2e5f0e24773dad81d38bd6b689e36afe9dda (diff) | |
download | cgit-5e75128a8bee885d83563d8c521172328d511d12.zip cgit-5e75128a8bee885d83563d8c521172328d511d12.tar.gz cgit-5e75128a8bee885d83563d8c521172328d511d12.tar.bz2 |
Add html_include()
This is a function used to include external htmlfiles in cgit-
generated pages.
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
-rw-r--r-- | cgit.h | 1 | ||||
-rw-r--r-- | html.c | 14 |
2 files changed, 15 insertions, 0 deletions
@@ -146,2 +146,3 @@ extern void html_link_close(void); extern void html_filemode(unsigned short mode); +extern int html_include(const char *filename); @@ -168 +168,15 @@ void html_filemode(unsigned short 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; +} |