author | Lars Hjemli <hjemli@gmail.com> | 2008-03-24 15:00:27 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2008-03-24 15:00:27 (UTC) |
commit | f34478cbe0214a201e7ecef3e79ed6c957b7beee (patch) (unidiff) | |
tree | 1ee05da742488cab51a06e083d26b7b58d829b43 /ui-shared.c | |
parent | e0e4478e7b4812f822d60a13a33525f8e529e1e8 (diff) | |
download | cgit-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>
-rw-r--r-- | ui-shared.c | 17 |
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 | |||
@@ -560,17 +560,32 @@ void cgit_print_pageheader(struct cgit_context *ctx) | |||
560 | 560 | ||
561 | void cgit_print_filemode(unsigned short mode) | 561 | void 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: */ | 576 | void 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 | } | ||