X-Git-Url: https://gitweb.ps.run/ps-cgit/blobdiff_plain/d1f3bbe9d22029f45a77bb938c176ccc0c827d46..b608e88adb6f77328288afb6dd0eddf674fc9b5b:/ui-shared.c?ds=sidebyside diff --git a/ui-shared.c b/ui-shared.c index b9f487a..2596023 100644 --- a/ui-shared.c +++ b/ui-shared.c @@ -7,6 +7,7 @@ */ #include "cgit.h" +#include "html.h" const char cgit_doctype[] = "tm_hour, tm->tm_min, tm->tm_sec); } -static long ttl_seconds(long ttl) -{ - if (ttl<0) - return 60 * 60 * 24 * 365; - else - return ttl * 60; -} - void cgit_print_error(char *msg) { html("
| "); html("\n"); // html(" | ");
html("\n");
@@ -531,22 +534,22 @@ void cgit_print_pageheader(char *title, int show_search)
html("search\n"); html("\n"); } else { - if (!ctx.cfg.index_info || html_include(ctx.cfg.index_info)) + if (!ctx->cfg.index_info || html_include(ctx->cfg.index_info)) html(default_info); } @@ -555,16 +558,19 @@ void cgit_print_pageheader(char *title, int show_search) html(" | \n"); } - -void cgit_print_snapshot_start(const char *mimetype, const char *filename, - struct cacheitem *item) +void cgit_print_filemode(unsigned short mode) { - htmlf("Content-Type: %s\n", mimetype); - htmlf("Content-Disposition: inline; filename=\"%s\"\n", filename); - htmlf("Last-Modified: %s\n", http_date(item->st.st_mtime)); - htmlf("Expires: %s\n", http_date(item->st.st_mtime + - ttl_seconds(item->ttl))); - html("\n"); + if (S_ISDIR(mode)) + html("d"); + else if (S_ISLNK(mode)) + html("l"); + else if (S_ISGITLINK(mode)) + html("m"); + else + html("-"); + html_fileperm(mode >> 6); + html_fileperm(mode >> 3); + html_fileperm(mode); } /* vim:set sw=8: */ |