summaryrefslogtreecommitdiffabout
path: root/cgit.c
authorLars Hjemli <hjemli@gmail.com>2008-03-24 15:50:57 (UTC)
committer Lars Hjemli <hjemli@gmail.com>2008-03-24 15:50:57 (UTC)
commita4d1ca1dc6ff8171694d9e2280b6075a1beced0c (patch) (unidiff)
tree8ccfdd78b7fe61a54bf09c11a130cfbfa8ed50c8 /cgit.c
parentc5984a9896b39748e61daf6e620483749654b102 (diff)
downloadcgit-a4d1ca1dc6ff8171694d9e2280b6075a1beced0c.zip
cgit-a4d1ca1dc6ff8171694d9e2280b6075a1beced0c.tar.gz
cgit-a4d1ca1dc6ff8171694d9e2280b6075a1beced0c.tar.bz2
Add ui-shared.h
This is finally a proper headerfile for the shared ui-functions which used to reside in cgit.h Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Diffstat (limited to 'cgit.c') (more/less context) (ignore whitespace changes)
-rw-r--r--cgit.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/cgit.c b/cgit.c
index 79e0e43..dbb023e 100644
--- a/cgit.c
+++ b/cgit.c
@@ -1,42 +1,43 @@
1/* cgit.c: cgi for the git scm 1/* cgit.c: cgi for the git scm
2 * 2 *
3 * Copyright (C) 2006 Lars Hjemli 3 * Copyright (C) 2006 Lars Hjemli
4 * 4 *
5 * Licensed under GNU General Public License v2 5 * Licensed under GNU General Public License v2
6 * (see COPYING for full license text) 6 * (see COPYING for full license text)
7 */ 7 */
8 8
9#include "cgit.h" 9#include "cgit.h"
10#include "cmd.h" 10#include "cmd.h"
11#include "ui-shared.h"
11 12
12static int cgit_prepare_cache(struct cacheitem *item) 13static int cgit_prepare_cache(struct cacheitem *item)
13{ 14{
14 if (!ctx.repo && ctx.qry.repo) { 15 if (!ctx.repo && ctx.qry.repo) {
15 ctx.page.title = fmt("%s - %s", ctx.cfg.root_title, 16 ctx.page.title = fmt("%s - %s", ctx.cfg.root_title,
16 "Bad request"); 17 "Bad request");
17 cgit_print_http_headers(&ctx); 18 cgit_print_http_headers(&ctx);
18 cgit_print_docstart(&ctx); 19 cgit_print_docstart(&ctx);
19 cgit_print_pageheader(&ctx); 20 cgit_print_pageheader(&ctx);
20 cgit_print_error(fmt("Unknown repo: %s", ctx.qry.repo)); 21 cgit_print_error(fmt("Unknown repo: %s", ctx.qry.repo));
21 cgit_print_docend(); 22 cgit_print_docend();
22 return 0; 23 return 0;
23 } 24 }
24 25
25 if (!ctx.repo) { 26 if (!ctx.repo) {
26 item->name = xstrdup(fmt("%s/index.html", ctx.cfg.cache_root)); 27 item->name = xstrdup(fmt("%s/index.html", ctx.cfg.cache_root));
27 item->ttl = ctx.cfg.cache_root_ttl; 28 item->ttl = ctx.cfg.cache_root_ttl;
28 return 1; 29 return 1;
29 } 30 }
30 31
31 if (!cgit_cmd) { 32 if (!cgit_cmd) {
32 item->name = xstrdup(fmt("%s/%s/index.%s.html", ctx.cfg.cache_root, 33 item->name = xstrdup(fmt("%s/%s/index.%s.html", ctx.cfg.cache_root,
33 cache_safe_filename(ctx.repo->url), 34 cache_safe_filename(ctx.repo->url),
34 cache_safe_filename(ctx.qry.raw))); 35 cache_safe_filename(ctx.qry.raw)));
35 item->ttl = ctx.cfg.cache_repo_ttl; 36 item->ttl = ctx.cfg.cache_repo_ttl;
36 } else { 37 } else {
37 item->name = xstrdup(fmt("%s/%s/%s/%s.html", ctx.cfg.cache_root, 38 item->name = xstrdup(fmt("%s/%s/%s/%s.html", ctx.cfg.cache_root,
38 cache_safe_filename(ctx.repo->url), 39 cache_safe_filename(ctx.repo->url),
39 ctx.qry.page, 40 ctx.qry.page,
40 cache_safe_filename(ctx.qry.raw))); 41 cache_safe_filename(ctx.qry.raw)));
41 if (ctx.qry.has_symref) 42 if (ctx.qry.has_symref)
42 item->ttl = ctx.cfg.cache_dynamic_ttl; 43 item->ttl = ctx.cfg.cache_dynamic_ttl;