summaryrefslogtreecommitdiffabout
path: root/shared.c
Unidiff
Diffstat (limited to 'shared.c') (more/less context) (ignore whitespace changes)
-rw-r--r--shared.c74
1 files changed, 74 insertions, 0 deletions
diff --git a/shared.c b/shared.c
new file mode 100644
index 0000000..c58a2ff
--- a/dev/null
+++ b/shared.c
@@ -0,0 +1,74 @@
1#include "cgit.h"
2
3char *cgit_root = "/usr/src/git";
4char *cgit_root_title = "Git repository browser";
5char *cgit_css = "/cgit.css";
6char *cgit_logo = "/git-logo.png";
7char *cgit_logo_link = "http://www.kernel.org/pub/software/scm/git/docs/";
8char *cgit_virtual_root = NULL;
9
10char *cgit_cache_root = "/var/cache/cgit";
11
12int cgit_max_lock_attempts = 5;
13int cgit_cache_root_ttl = 5;
14int cgit_cache_repo_ttl = 5;
15int cgit_cache_dynamic_ttl = 5;
16int cgit_cache_static_ttl = -1;
17int cgit_cache_max_create_time = 5;
18
19char *cgit_repo_name = NULL;
20char *cgit_repo_desc = NULL;
21char *cgit_repo_owner = NULL;
22
23int cgit_query_has_symref = 0;
24int cgit_query_has_sha1 = 0;
25
26char *cgit_querystring = NULL;
27char *cgit_query_repo = NULL;
28char *cgit_query_page = NULL;
29char *cgit_query_head = NULL;
30char *cgit_query_sha1 = NULL;
31
32int htmlfd = 0;
33
34void cgit_global_config_cb(const char *name, const char *value)
35{
36 if (!strcmp(name, "root"))
37 cgit_root = xstrdup(value);
38 else if (!strcmp(name, "root-title"))
39 cgit_root_title = xstrdup(value);
40 else if (!strcmp(name, "css"))
41 cgit_css = xstrdup(value);
42 else if (!strcmp(name, "logo"))
43 cgit_logo = xstrdup(value);
44 else if (!strcmp(name, "logo-link"))
45 cgit_logo_link = xstrdup(value);
46 else if (!strcmp(name, "virtual-root"))
47 cgit_virtual_root = xstrdup(value);
48}
49
50void cgit_repo_config_cb(const char *name, const char *value)
51{
52 if (!strcmp(name, "name"))
53 cgit_repo_name = xstrdup(value);
54 else if (!strcmp(name, "desc"))
55 cgit_repo_desc = xstrdup(value);
56 else if (!strcmp(name, "owner"))
57 cgit_repo_owner = xstrdup(value);
58}
59
60void cgit_querystring_cb(const char *name, const char *value)
61{
62 if (!strcmp(name,"r"))
63 cgit_query_repo = xstrdup(value);
64 else if (!strcmp(name, "p"))
65 cgit_query_page = xstrdup(value);
66 else if (!strcmp(name, "h")) {
67 cgit_query_head = xstrdup(value);
68 cgit_query_has_symref = 1;
69 } else if (!strcmp(name, "id")) {
70 cgit_query_sha1 = xstrdup(value);
71 cgit_query_has_sha1 = 1;
72 }
73}
74