diff options
Diffstat (limited to 'cgi.c')
-rw-r--r-- | cgi.c | 20 |
1 files changed, 19 insertions, 1 deletions
@@ -77,6 +77,7 @@ static void pg_searchres(const struct req *, static void pg_show(struct req *, const char *); static void resp_begin_html(int, const char *); static void resp_begin_http(int, const char *); +static void resp_copy(const char *); static void resp_end_html(void); static void resp_searchform(const struct req *); static void resp_show(const struct req *, const char *); @@ -368,6 +369,20 @@ resp_begin_http(int code, const char *msg) } static void +resp_copy(const char *filename) +{ + char buf[4096]; + ssize_t sz; + int fd; + + if ((fd = open(filename, O_RDONLY)) != -1) { + fflush(stdout); + while ((sz = read(fd, buf, sizeof(buf))) > 0) + write(STDOUT_FILENO, buf, sz); + } +} + +static void resp_begin_html(int code, const char *msg) { @@ -384,12 +399,16 @@ resp_begin_html(int code, const char *msg) "<BODY>\n" "<!-- Begin page content. //-->\n", CSS_DIR, CUSTOMIZE_TITLE); + + resp_copy(MAN_DIR "/header.html"); } static void resp_end_html(void) { + resp_copy(MAN_DIR "/footer.html"); + puts("</BODY>\n" "</HTML>"); } @@ -399,7 +418,6 @@ resp_searchform(const struct req *req) { int i; - puts(CUSTOMIZE_BEGIN); puts("<!-- Begin search form. //-->"); printf("<DIV ID=\"mancgi\">\n" "<FORM ACTION=\"%s\" METHOD=\"get\">\n" |