summaryrefslogtreecommitdiffabout
path: root/ui-shared.c
authorLars Hjemli <hjemli@gmail.com>2008-03-24 15:00:27 (UTC)
committer Lars Hjemli <hjemli@gmail.com>2008-03-24 15:00:27 (UTC)
commitf34478cbe0214a201e7ecef3e79ed6c957b7beee (patch) (unidiff)
tree1ee05da742488cab51a06e083d26b7b58d829b43 /ui-shared.c
parente0e4478e7b4812f822d60a13a33525f8e529e1e8 (diff)
downloadcgit-f34478cbe0214a201e7ecef3e79ed6c957b7beee.zip
cgit-f34478cbe0214a201e7ecef3e79ed6c957b7beee.tar.gz
cgit-f34478cbe0214a201e7ecef3e79ed6c957b7beee.tar.bz2
Refactor snapshot support
The snapshot support needs to be split between output- and config-related functions to get the layering between shared.c and ui-*.c right. There is also some codestyle-issues which needs fixing to make the snapshot functions more similar to the rest of the cgit code. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Diffstat (limited to 'ui-shared.c') (more/less context) (show whitespace changes)
-rw-r--r--ui-shared.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/ui-shared.c b/ui-shared.c
index 2596023..aa65988 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -552,25 +552,40 @@ void cgit_print_pageheader(struct cgit_context *ctx)
552 if (!ctx->cfg.index_info || html_include(ctx->cfg.index_info)) 552 if (!ctx->cfg.index_info || html_include(ctx->cfg.index_info))
553 html(default_info); 553 html(default_info);
554 } 554 }
555 555
556 html("</td></tr></table></td>\n"); 556 html("</td></tr></table></td>\n");
557 557
558 html("<td id='content'>\n"); 558 html("<td id='content'>\n");
559} 559}
560 560
561void cgit_print_filemode(unsigned short mode) 561void cgit_print_filemode(unsigned short mode)
562{ 562{
563 if (S_ISDIR(mode)) 563 if (S_ISDIR(mode))
564 html("d"); 564 html("d");
565 else if (S_ISLNK(mode)) 565 else if (S_ISLNK(mode))
566 html("l"); 566 html("l");
567 else if (S_ISGITLINK(mode)) 567 else if (S_ISGITLINK(mode))
568 html("m"); 568 html("m");
569 else 569 else
570 html("-"); 570 html("-");
571 html_fileperm(mode >> 6); 571 html_fileperm(mode >> 6);
572 html_fileperm(mode >> 3); 572 html_fileperm(mode >> 3);
573 html_fileperm(mode); 573 html_fileperm(mode);
574} 574}
575 575
576/* vim:set sw=8: */ 576void cgit_print_snapshot_links(const char *repo, const char *head,
577 const char *hex, int snapshots)
578{
579 const struct cgit_snapshot_format* f;
580 char *filename;
581
582 for (f = cgit_snapshot_formats; f->suffix; f++) {
583 if (!(snapshots & f->bit))
584 continue;
585 filename = fmt("%s-%s%s", cgit_repobasename(repo), hex,
586 f->suffix);
587 cgit_snapshot_link(filename, NULL, NULL, (char *)head,
588 (char *)hex, filename);
589 html("<br/>");
590 }
591}