]> gitweb.ps.run Git - ps-cgit/blobdiff - ui-shared.c
Introduce html.h
[ps-cgit] / ui-shared.c
index b9f487a6c388c2e9634396c9bddd9ea42ec38de4..2eff79d63bee6bd6f55dacc609879f61f59c603a 100644 (file)
@@ -7,6 +7,7 @@
  */
 
 #include "cgit.h"
+#include "html.h"
 
 const char cgit_doctype[] =
 "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n"
@@ -476,7 +477,7 @@ void cgit_print_pageheader(char *title, int show_search)
        htmlf("'><img src='%s' alt='cgit'/></a>\n",
              ctx.cfg.logo);
        html("</td></tr>\n<tr><td class='sidebar'>\n");
-       if (ctx.qry.repo) {
+       if (ctx.repo) {
                html("<h1 class='first'>");
                html_txt(strrpart(ctx.repo->name, 20));
                html("</h1>\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: */