summaryrefslogtreecommitdiffabout
path: root/shared.c
Unidiff
Diffstat (limited to 'shared.c') (more/less context) (show whitespace changes)
-rw-r--r--shared.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/shared.c b/shared.c
index 76e10d0..539d533 100644
--- a/shared.c
+++ b/shared.c
@@ -14,48 +14,51 @@ int cgit_cmd;
14 14
15const char *cgit_version = CGIT_VERSION; 15const char *cgit_version = CGIT_VERSION;
16 16
17void cgit_prepare_context(struct cgit_context *ctx) 17void cgit_prepare_context(struct cgit_context *ctx)
18{ 18{
19 memset(ctx, 0, sizeof(ctx)); 19 memset(ctx, 0, sizeof(ctx));
20 ctx->cfg.agefile = "info/web/last-modified"; 20 ctx->cfg.agefile = "info/web/last-modified";
21 ctx->cfg.cache_dynamic_ttl = 5; 21 ctx->cfg.cache_dynamic_ttl = 5;
22 ctx->cfg.cache_max_create_time = 5; 22 ctx->cfg.cache_max_create_time = 5;
23 ctx->cfg.cache_repo_ttl = 5; 23 ctx->cfg.cache_repo_ttl = 5;
24 ctx->cfg.cache_root = CGIT_CACHE_ROOT; 24 ctx->cfg.cache_root = CGIT_CACHE_ROOT;
25 ctx->cfg.cache_root_ttl = 5; 25 ctx->cfg.cache_root_ttl = 5;
26 ctx->cfg.cache_static_ttl = -1; 26 ctx->cfg.cache_static_ttl = -1;
27 ctx->cfg.css = "/cgit.css"; 27 ctx->cfg.css = "/cgit.css";
28 ctx->cfg.logo = "/git-logo.png"; 28 ctx->cfg.logo = "/git-logo.png";
29 ctx->cfg.max_commit_count = 50; 29 ctx->cfg.max_commit_count = 50;
30 ctx->cfg.max_lock_attempts = 5; 30 ctx->cfg.max_lock_attempts = 5;
31 ctx->cfg.max_msg_len = 60; 31 ctx->cfg.max_msg_len = 60;
32 ctx->cfg.max_repodesc_len = 60; 32 ctx->cfg.max_repodesc_len = 60;
33 ctx->cfg.module_link = "./?repo=%s&page=commit&id=%s"; 33 ctx->cfg.module_link = "./?repo=%s&page=commit&id=%s";
34 ctx->cfg.renamelimit = -1; 34 ctx->cfg.renamelimit = -1;
35 ctx->cfg.robots = "index, nofollow"; 35 ctx->cfg.robots = "index, nofollow";
36 ctx->cfg.root_title = "Git repository browser"; 36 ctx->cfg.root_title = "Git repository browser";
37 ctx->cfg.script_name = CGIT_SCRIPT_NAME; 37 ctx->cfg.script_name = CGIT_SCRIPT_NAME;
38 ctx->page.mimetype = "text/html";
39 ctx->page.charset = PAGE_ENCODING;
40 ctx->page.filename = NULL;
38} 41}
39 42
40int cgit_get_cmd_index(const char *cmd) 43int cgit_get_cmd_index(const char *cmd)
41{ 44{
42 static char *cmds[] = {"log", "commit", "diff", "tree", "blob", 45 static char *cmds[] = {"log", "commit", "diff", "tree", "blob",
43 "snapshot", "tag", "refs", "patch", NULL}; 46 "snapshot", "tag", "refs", "patch", NULL};
44 int i; 47 int i;
45 48
46 for(i = 0; cmds[i]; i++) 49 for(i = 0; cmds[i]; i++)
47 if (!strcmp(cmd, cmds[i])) 50 if (!strcmp(cmd, cmds[i]))
48 return i + 1; 51 return i + 1;
49 return 0; 52 return 0;
50} 53}
51 54
52int chk_zero(int result, char *msg) 55int chk_zero(int result, char *msg)
53{ 56{
54 if (result != 0) 57 if (result != 0)
55 die("%s: %s", msg, strerror(errno)); 58 die("%s: %s", msg, strerror(errno));
56 return result; 59 return result;
57} 60}
58 61
59int chk_positive(int result, char *msg) 62int chk_positive(int result, char *msg)
60{ 63{
61 if (result <= 0) 64 if (result <= 0)