|
diff --git a/cgit.c b/cgit.c index b3dd119..3943a0f 100644 --- a/ cgit.c+++ b/ cgit.c |
|
@@ -1,76 +1,78 @@ |
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 | #include "ui-shared.h" |
12 | |
12 | |
| |
13 | const char *cgit_version = CGIT_VERSION; |
| |
14 | |
13 | void config_cb(const char *name, const char *value) |
15 | void config_cb(const char *name, const char *value) |
14 | { |
16 | { |
15 | if (!strcmp(name, "root-title")) |
17 | if (!strcmp(name, "root-title")) |
16 | ctx.cfg.root_title = xstrdup(value); |
18 | ctx.cfg.root_title = xstrdup(value); |
17 | else if (!strcmp(name, "css")) |
19 | else if (!strcmp(name, "css")) |
18 | ctx.cfg.css = xstrdup(value); |
20 | ctx.cfg.css = xstrdup(value); |
19 | else if (!strcmp(name, "logo")) |
21 | else if (!strcmp(name, "logo")) |
20 | ctx.cfg.logo = xstrdup(value); |
22 | ctx.cfg.logo = xstrdup(value); |
21 | else if (!strcmp(name, "index-header")) |
23 | else if (!strcmp(name, "index-header")) |
22 | ctx.cfg.index_header = xstrdup(value); |
24 | ctx.cfg.index_header = xstrdup(value); |
23 | else if (!strcmp(name, "index-info")) |
25 | else if (!strcmp(name, "index-info")) |
24 | ctx.cfg.index_info = xstrdup(value); |
26 | ctx.cfg.index_info = xstrdup(value); |
25 | else if (!strcmp(name, "logo-link")) |
27 | else if (!strcmp(name, "logo-link")) |
26 | ctx.cfg.logo_link = xstrdup(value); |
28 | ctx.cfg.logo_link = xstrdup(value); |
27 | else if (!strcmp(name, "module-link")) |
29 | else if (!strcmp(name, "module-link")) |
28 | ctx.cfg.module_link = xstrdup(value); |
30 | ctx.cfg.module_link = xstrdup(value); |
29 | else if (!strcmp(name, "virtual-root")) { |
31 | else if (!strcmp(name, "virtual-root")) { |
30 | ctx.cfg.virtual_root = trim_end(value, '/'); |
32 | ctx.cfg.virtual_root = trim_end(value, '/'); |
31 | if (!ctx.cfg.virtual_root && (!strcmp(value, "/"))) |
33 | if (!ctx.cfg.virtual_root && (!strcmp(value, "/"))) |
32 | ctx.cfg.virtual_root = ""; |
34 | ctx.cfg.virtual_root = ""; |
33 | } else if (!strcmp(name, "nocache")) |
35 | } else if (!strcmp(name, "nocache")) |
34 | ctx.cfg.nocache = atoi(value); |
36 | ctx.cfg.nocache = atoi(value); |
35 | else if (!strcmp(name, "snapshots")) |
37 | else if (!strcmp(name, "snapshots")) |
36 | ctx.cfg.snapshots = cgit_parse_snapshots_mask(value); |
38 | ctx.cfg.snapshots = cgit_parse_snapshots_mask(value); |
37 | else if (!strcmp(name, "enable-index-links")) |
39 | else if (!strcmp(name, "enable-index-links")) |
38 | ctx.cfg.enable_index_links = atoi(value); |
40 | ctx.cfg.enable_index_links = atoi(value); |
39 | else if (!strcmp(name, "enable-log-filecount")) |
41 | else if (!strcmp(name, "enable-log-filecount")) |
40 | ctx.cfg.enable_log_filecount = atoi(value); |
42 | ctx.cfg.enable_log_filecount = atoi(value); |
41 | else if (!strcmp(name, "enable-log-linecount")) |
43 | else if (!strcmp(name, "enable-log-linecount")) |
42 | ctx.cfg.enable_log_linecount = atoi(value); |
44 | ctx.cfg.enable_log_linecount = atoi(value); |
43 | else if (!strcmp(name, "cache-root")) |
45 | else if (!strcmp(name, "cache-root")) |
44 | ctx.cfg.cache_root = xstrdup(value); |
46 | ctx.cfg.cache_root = xstrdup(value); |
45 | else if (!strcmp(name, "cache-root-ttl")) |
47 | else if (!strcmp(name, "cache-root-ttl")) |
46 | ctx.cfg.cache_root_ttl = atoi(value); |
48 | ctx.cfg.cache_root_ttl = atoi(value); |
47 | else if (!strcmp(name, "cache-repo-ttl")) |
49 | else if (!strcmp(name, "cache-repo-ttl")) |
48 | ctx.cfg.cache_repo_ttl = atoi(value); |
50 | ctx.cfg.cache_repo_ttl = atoi(value); |
49 | else if (!strcmp(name, "cache-static-ttl")) |
51 | else if (!strcmp(name, "cache-static-ttl")) |
50 | ctx.cfg.cache_static_ttl = atoi(value); |
52 | ctx.cfg.cache_static_ttl = atoi(value); |
51 | else if (!strcmp(name, "cache-dynamic-ttl")) |
53 | else if (!strcmp(name, "cache-dynamic-ttl")) |
52 | ctx.cfg.cache_dynamic_ttl = atoi(value); |
54 | ctx.cfg.cache_dynamic_ttl = atoi(value); |
53 | else if (!strcmp(name, "max-message-length")) |
55 | else if (!strcmp(name, "max-message-length")) |
54 | ctx.cfg.max_msg_len = atoi(value); |
56 | ctx.cfg.max_msg_len = atoi(value); |
55 | else if (!strcmp(name, "max-repodesc-length")) |
57 | else if (!strcmp(name, "max-repodesc-length")) |
56 | ctx.cfg.max_repodesc_len = atoi(value); |
58 | ctx.cfg.max_repodesc_len = atoi(value); |
57 | else if (!strcmp(name, "max-commit-count")) |
59 | else if (!strcmp(name, "max-commit-count")) |
58 | ctx.cfg.max_commit_count = atoi(value); |
60 | ctx.cfg.max_commit_count = atoi(value); |
59 | else if (!strcmp(name, "summary-log")) |
61 | else if (!strcmp(name, "summary-log")) |
60 | ctx.cfg.summary_log = atoi(value); |
62 | ctx.cfg.summary_log = atoi(value); |
61 | else if (!strcmp(name, "summary-branches")) |
63 | else if (!strcmp(name, "summary-branches")) |
62 | ctx.cfg.summary_branches = atoi(value); |
64 | ctx.cfg.summary_branches = atoi(value); |
63 | else if (!strcmp(name, "summary-tags")) |
65 | else if (!strcmp(name, "summary-tags")) |
64 | ctx.cfg.summary_tags = atoi(value); |
66 | ctx.cfg.summary_tags = atoi(value); |
65 | else if (!strcmp(name, "agefile")) |
67 | else if (!strcmp(name, "agefile")) |
66 | ctx.cfg.agefile = xstrdup(value); |
68 | ctx.cfg.agefile = xstrdup(value); |
67 | else if (!strcmp(name, "renamelimit")) |
69 | else if (!strcmp(name, "renamelimit")) |
68 | ctx.cfg.renamelimit = atoi(value); |
70 | ctx.cfg.renamelimit = atoi(value); |
69 | else if (!strcmp(name, "robots")) |
71 | else if (!strcmp(name, "robots")) |
70 | ctx.cfg.robots = xstrdup(value); |
72 | ctx.cfg.robots = xstrdup(value); |
71 | else if (!strcmp(name, "clone-prefix")) |
73 | else if (!strcmp(name, "clone-prefix")) |
72 | ctx.cfg.clone_prefix = xstrdup(value); |
74 | ctx.cfg.clone_prefix = xstrdup(value); |
73 | else if (!strcmp(name, "repo.group")) |
75 | else if (!strcmp(name, "repo.group")) |
74 | ctx.cfg.repo_group = xstrdup(value); |
76 | ctx.cfg.repo_group = xstrdup(value); |
75 | else if (!strcmp(name, "repo.url")) |
77 | else if (!strcmp(name, "repo.url")) |
76 | ctx.repo = cgit_add_repo(value); |
78 | ctx.repo = cgit_add_repo(value); |
|