diff options
| -rw-r--r-- | cgit.h | 1 | ||||
| -rw-r--r-- | html.c | 14 |
2 files changed, 15 insertions, 0 deletions
| @@ -144,6 +144,7 @@ extern void html_hidden(char *name, char *value); | |||
| 144 | extern void html_link_open(char *url, char *title, char *class); | 144 | extern void html_link_open(char *url, char *title, char *class); |
| 145 | extern void html_link_close(void); | 145 | extern void html_link_close(void); |
| 146 | extern void html_filemode(unsigned short mode); | 146 | extern void html_filemode(unsigned short mode); |
| 147 | extern int html_include(const char *filename); | ||
| 147 | 148 | ||
| 148 | extern int cgit_read_config(const char *filename, configfn fn); | 149 | extern int cgit_read_config(const char *filename, configfn fn); |
| 149 | extern int cgit_parse_query(char *txt, configfn fn); | 150 | extern int cgit_parse_query(char *txt, configfn fn); |
| @@ -166,3 +166,17 @@ void html_filemode(unsigned short mode) | |||
| 166 | html_fileperm(mode >> 3); | 166 | html_fileperm(mode >> 3); |
| 167 | html_fileperm(mode); | 167 | html_fileperm(mode); |
| 168 | } | 168 | } |
| 169 | |||
| 170 | int html_include(const char *filename) | ||
| 171 | { | ||
| 172 | FILE *f; | ||
| 173 | char buf[4096]; | ||
| 174 | size_t len; | ||
| 175 | |||
| 176 | if (!(f = fopen(filename, "r"))) | ||
| 177 | return -1; | ||
| 178 | while((len = fread(buf, 1, 4096, f)) > 0) | ||
| 179 | write(htmlfd, buf, len); | ||
| 180 | fclose(f); | ||
| 181 | return 0; | ||
| 182 | } | ||
