]> git.cameronkatri.com Git - cgit.git/blob - shared.c
Add head comment to ui-commit.c
[cgit.git] / shared.c
1 #include "cgit.h"
2
3 char *cgit_root = "/usr/src/git";
4 char *cgit_root_title = "Git repository browser";
5 char *cgit_css = "/cgit.css";
6 char *cgit_logo = "/git-logo.png";
7 char *cgit_logo_link = "http://www.kernel.org/pub/software/scm/git/docs/";
8 char *cgit_virtual_root = NULL;
9
10 char *cgit_cache_root = "/var/cache/cgit";
11
12 int cgit_max_lock_attempts = 5;
13 int cgit_cache_root_ttl = 5;
14 int cgit_cache_repo_ttl = 5;
15 int cgit_cache_dynamic_ttl = 5;
16 int cgit_cache_static_ttl = -1;
17 int cgit_cache_max_create_time = 5;
18
19 char *cgit_repo_name = NULL;
20 char *cgit_repo_desc = NULL;
21 char *cgit_repo_owner = NULL;
22
23 int cgit_query_has_symref = 0;
24 int cgit_query_has_sha1 = 0;
25
26 char *cgit_querystring = NULL;
27 char *cgit_query_repo = NULL;
28 char *cgit_query_page = NULL;
29 char *cgit_query_head = NULL;
30 char *cgit_query_sha1 = NULL;
31 int cgit_query_ofs = 0;
32
33 int htmlfd = 0;
34
35 void cgit_global_config_cb(const char *name, const char *value)
36 {
37 if (!strcmp(name, "root"))
38 cgit_root = xstrdup(value);
39 else if (!strcmp(name, "root-title"))
40 cgit_root_title = xstrdup(value);
41 else if (!strcmp(name, "css"))
42 cgit_css = xstrdup(value);
43 else if (!strcmp(name, "logo"))
44 cgit_logo = xstrdup(value);
45 else if (!strcmp(name, "logo-link"))
46 cgit_logo_link = xstrdup(value);
47 else if (!strcmp(name, "virtual-root"))
48 cgit_virtual_root = xstrdup(value);
49 }
50
51 void cgit_repo_config_cb(const char *name, const char *value)
52 {
53 if (!strcmp(name, "name"))
54 cgit_repo_name = xstrdup(value);
55 else if (!strcmp(name, "desc"))
56 cgit_repo_desc = xstrdup(value);
57 else if (!strcmp(name, "owner"))
58 cgit_repo_owner = xstrdup(value);
59 }
60
61 void cgit_querystring_cb(const char *name, const char *value)
62 {
63 if (!strcmp(name,"r")) {
64 cgit_query_repo = xstrdup(value);
65 } else if (!strcmp(name, "p")) {
66 cgit_query_page = xstrdup(value);
67 } else if (!strcmp(name, "h")) {
68 cgit_query_head = xstrdup(value);
69 cgit_query_has_symref = 1;
70 } else if (!strcmp(name, "id")) {
71 cgit_query_sha1 = xstrdup(value);
72 cgit_query_has_sha1 = 1;
73 } else if (!strcmp(name, "ofs")) {
74 cgit_query_ofs = atoi(value);
75 }
76 }
77