diff options
Diffstat (limited to 'ui_70-shared.c')
-rw-r--r-- | ui_70-shared.c | 23 |
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(); } |