summaryrefslogtreecommitdiffabout
path: root/cgit.c
Unidiff
Diffstat (limited to 'cgit.c') (more/less context) (ignore whitespace changes)
-rw-r--r--cgit.c26
1 files changed, 0 insertions, 26 deletions
diff --git a/cgit.c b/cgit.c
index dc91125..5567859 100644
--- a/cgit.c
+++ b/cgit.c
@@ -32,74 +32,48 @@ char *cgit_virtual_root = NULL;
32char *cgit_cache_root = "/var/cache/cgit"; 32char *cgit_cache_root = "/var/cache/cgit";
33 33
34int cgit_max_lock_attempts = 5; 34int cgit_max_lock_attempts = 5;
35int cgit_cache_root_ttl = 5; 35int cgit_cache_root_ttl = 5;
36int cgit_cache_repo_ttl = 5; 36int cgit_cache_repo_ttl = 5;
37int cgit_cache_dynamic_ttl = 5; 37int cgit_cache_dynamic_ttl = 5;
38int cgit_cache_static_ttl = -1; 38int cgit_cache_static_ttl = -1;
39int cgit_cache_max_create_time = 5; 39int cgit_cache_max_create_time = 5;
40 40
41char *cgit_repo_name = NULL; 41char *cgit_repo_name = NULL;
42char *cgit_repo_desc = NULL; 42char *cgit_repo_desc = NULL;
43char *cgit_repo_owner = NULL; 43char *cgit_repo_owner = NULL;
44 44
45int cgit_query_has_symref = 0; 45int cgit_query_has_symref = 0;
46int cgit_query_has_sha1 = 0; 46int cgit_query_has_sha1 = 0;
47 47
48char *cgit_querystring = NULL; 48char *cgit_querystring = NULL;
49char *cgit_query_repo = NULL; 49char *cgit_query_repo = NULL;
50char *cgit_query_page = NULL; 50char *cgit_query_page = NULL;
51char *cgit_query_head = NULL; 51char *cgit_query_head = NULL;
52char *cgit_query_sha1 = NULL; 52char *cgit_query_sha1 = NULL;
53 53
54struct cacheitem cacheitem; 54struct cacheitem cacheitem;
55 55
56int cgit_parse_query(char *txt, configfn fn)
57{
58 char *t, *value = NULL, c;
59
60 if (!txt)
61 return 0;
62
63 t = txt = xstrdup(txt);
64
65 while((c=*t) != '\0') {
66 if (c=='=') {
67 *t = '\0';
68 value = t+1;
69 } else if (c=='&') {
70 *t = '\0';
71 (*fn)(txt, value);
72 txt = t+1;
73 value = NULL;
74 }
75 t++;
76 }
77 if (t!=txt)
78 (*fn)(txt, value);
79 return 0;
80}
81
82void cgit_global_config_cb(const char *name, const char *value) 56void cgit_global_config_cb(const char *name, const char *value)
83{ 57{
84 if (!strcmp(name, "root")) 58 if (!strcmp(name, "root"))
85 cgit_root = xstrdup(value); 59 cgit_root = xstrdup(value);
86 else if (!strcmp(name, "root-title")) 60 else if (!strcmp(name, "root-title"))
87 cgit_root_title = xstrdup(value); 61 cgit_root_title = xstrdup(value);
88 else if (!strcmp(name, "css")) 62 else if (!strcmp(name, "css"))
89 cgit_css = xstrdup(value); 63 cgit_css = xstrdup(value);
90 else if (!strcmp(name, "logo")) 64 else if (!strcmp(name, "logo"))
91 cgit_logo = xstrdup(value); 65 cgit_logo = xstrdup(value);
92 else if (!strcmp(name, "logo-link")) 66 else if (!strcmp(name, "logo-link"))
93 cgit_logo_link = xstrdup(value); 67 cgit_logo_link = xstrdup(value);
94 else if (!strcmp(name, "virtual-root")) 68 else if (!strcmp(name, "virtual-root"))
95 cgit_virtual_root = xstrdup(value); 69 cgit_virtual_root = xstrdup(value);
96} 70}
97 71
98void cgit_repo_config_cb(const char *name, const char *value) 72void cgit_repo_config_cb(const char *name, const char *value)
99{ 73{
100 if (!strcmp(name, "name")) 74 if (!strcmp(name, "name"))
101 cgit_repo_name = xstrdup(value); 75 cgit_repo_name = xstrdup(value);
102 else if (!strcmp(name, "desc")) 76 else if (!strcmp(name, "desc"))
103 cgit_repo_desc = xstrdup(value); 77 cgit_repo_desc = xstrdup(value);
104 else if (!strcmp(name, "owner")) 78 else if (!strcmp(name, "owner"))
105 cgit_repo_owner = xstrdup(value); 79 cgit_repo_owner = xstrdup(value);