Add html_include()

This is a function used to include external htmlfiles in cgit-
generated pages.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
此提交包含在:
Lars Hjemli
2007-05-18 23:56:10 +02:00
父節點 08cc2e5f0e
當前提交 5e75128a8b
共有 2 個檔案被更改,包括 15 行新增0 行删除

14
html.c
查看文件

@@ -166,3 +166,17 @@ void html_filemode(unsigned short mode)
html_fileperm(mode >> 3);
html_fileperm(mode);
}
int html_include(const char *filename)
{
FILE *f;
char buf[4096];
size_t len;
if (!(f = fopen(filename, "r")))
return -1;
while((len = fread(buf, 1, 4096, f)) > 0)
write(htmlfd, buf, len);
fclose(f);
return 0;
}