|
|
|
@ -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(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|