X-Git-Url: https://gitweb.ps.run/ps-cgit/blobdiff_plain/d1f3bbe9d22029f45a77bb938c176ccc0c827d46..b1f9b9c1459cb9a30ebf80721aff6ef788d1f891:/ui-shared.c?ds=sidebyside diff --git a/ui-shared.c b/ui-shared.c index b9f487a..2eff79d 100644 --- a/ui-shared.c +++ b/ui-shared.c @@ -7,6 +7,7 @@ */ #include "cgit.h" +#include "html.h" const char cgit_doctype[] = "cgit\n", ctx.cfg.logo); html("\n\n"); - if (ctx.qry.repo) { + if (ctx.repo) { html("

"); html_txt(strrpart(ctx.repo->name, 20)); html("

\n"); @@ -567,4 +568,19 @@ void cgit_print_snapshot_start(const char *mimetype, const char *filename, html("\n"); } +void cgit_print_filemode(unsigned short mode) +{ + 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: */