summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKatolaZ <katolaz@freaknet.org>2019-03-29 23:38:28 +0000
committerKatolaZ <katolaz@freaknet.org>2019-03-29 23:38:28 +0000
commit9fff6c5452c5f5f071f0d334ec71f192b150f8ff (patch)
tree1e41097f07b198f26444309e557f728d7f9d66de
parent8185a40185fc81d5825e636180bf77186dff15a1 (diff)
added code to manage header
-rw-r--r--ui_70-shared.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/ui_70-shared.c b/ui_70-shared.c
index 9abf94c..629b283 100644
--- a/ui_70-shared.c
+++ b/ui_70-shared.c
@@ -98,6 +98,26 @@ void gopher_fileperm(unsigned short mode)
}
+void gopher_include(const char *fname){
+
+ FILE *f;
+ char buf[4096];
+ size_t len;
+
+ if (!(f = fopen(fname, "r"))) {
+ fprintf(stderr, "[cgit] Failed to include file %s: %s (%d).\n",
+ fname, strerror(errno), errno);
+ return -1;
+ }
+ while ((len = fread(buf, 1, 4096, f)) > 0)
+ html_raw(buf, len);
+ fclose(f);
+ return 0;
+}
+
+
+
+
void cgit_gopher_textf(const char *fmt, va_list ap){
va_list cp;
@@ -1049,6 +1069,9 @@ void cgit_print_layout_start(void)
{
/*cgit_print_http_headers();
cgit_print_docstart();*/
+ if (ctx.cfg.header)
+ gopher_include(ctx.cfg.header);
+
cgit_print_pageheader();
}