summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--cgit.h1
-rw-r--r--html.c14
2 files changed, 15 insertions, 0 deletions
diff --git a/cgit.h b/cgit.h
index f3d783e..fc44a71 100644
--- a/cgit.h
+++ b/cgit.h
@@ -146,2 +146,3 @@ extern void html_link_close(void);
extern void html_filemode(unsigned short mode);
+extern int html_include(const char *filename);
diff --git a/html.c b/html.c
index 175b4b6..33a956f 100644
--- a/html.c
+++ b/html.c
@@ -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;
+}