From 5e75128a8bee885d83563d8c521172328d511d12 Mon Sep 17 00:00:00 2001 From: Lars Hjemli Date: Fri, 18 May 2007 23:56:10 +0200 Subject: Add html_include() This is a function used to include external htmlfiles in cgit- generated pages. Signed-off-by: Lars Hjemli --- cgit.h | 1 + html.c | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/cgit.h b/cgit.h index f3d783e..fc44a71 100644 --- a/cgit.h +++ b/cgit.h @@ -144,6 +144,7 @@ extern void html_hidden(char *name, char *value); extern void html_link_open(char *url, char *title, char *class); extern void html_link_close(void); extern void html_filemode(unsigned short mode); +extern int html_include(const char *filename); extern int cgit_read_config(const char *filename, configfn fn); extern int cgit_parse_query(char *txt, configfn fn); diff --git a/html.c b/html.c index 175b4b6..33a956f 100644 --- a/html.c +++ b/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; +} -- cgit 1.4.1 le-at-jinx-hotel.txt?id=5cabc516dc5315133e92985510cd0dd8e0f835b8&follow=1'>commit diff
Commit message (Expand)Author
2020-08-18Highlight .in files as shJune McEnroe
2020-08-15Bump title buffer to 64KJune McEnroe
2020-08-09Publish "LibreTLS"June McEnroe
2020-08-02Add scooper update to "IRC Suite"June McEnroe
2020-07-31Add scooper to causal.agencyJune McEnroe
2020-07-25Fix setting second title request to GETJune McEnroe
2020-07-20Set pull.rebase trueJune McEnroe
2020-07-18Read from stdin in orderJune McEnroe
2020-07-18Actually fix nvim and doas presence testsJune McEnroe
2020-07-14Install up CGI with mode 700June McEnroe
2020-07-14Check that there is upload dataJune McEnroe
2020-07-14Add CGI upload program for temp.causal.agencyJune McEnroe
2020-07-10Add The Broken KingdomsJune McEnroe
2020-07-08Add facebook and twitter to title user-agentJune McEnroe
2020-06-30Tweak causal.agency for mostly no reasonJune McEnroe
2020-06-30Add Ancillary JusticeJune McEnroe
2020-06-26Add password non-manager to planJune McEnroe
2020-06-26Tweak TF2 sensitivities once moreJune McEnroe
2020-06-19Add note about litterbox bot useJune McEnroe
2020-06-19Publish "IRC suite"June McEnroe
2020-06-17Add errors to link.shJune McEnroe