|
diff --git a/shared.c b/shared.c index 6b5cfc2..5f2a5ce 100644 --- a/ shared.c+++ b/ shared.c |
|
@@ -1,77 +1,85 @@ |
| |
1 | /* shared.c: global vars + some callback functions |
| |
2 | * |
| |
3 | * Copyright (C) 2006 Lars Hjemli |
| |
4 | * |
| |
5 | * Licensed under GNU General Public License v2 |
| |
6 | * (see COPYING for full license text) |
| |
7 | */ |
| |
8 | |
1 | #include "cgit.h" |
9 | #include "cgit.h" |
2 | |
10 | |
3 | char *cgit_root = "/usr/src/git"; |
11 | char *cgit_root = "/usr/src/git"; |
4 | char *cgit_root_title = "Git repository browser"; |
12 | char *cgit_root_title = "Git repository browser"; |
5 | char *cgit_css = "/cgit.css"; |
13 | char *cgit_css = "/cgit.css"; |
6 | char *cgit_logo = "/git-logo.png"; |
14 | char *cgit_logo = "/git-logo.png"; |
7 | char *cgit_logo_link = "http://www.kernel.org/pub/software/scm/git/docs/"; |
15 | char *cgit_logo_link = "http://www.kernel.org/pub/software/scm/git/docs/"; |
8 | char *cgit_virtual_root = NULL; |
16 | char *cgit_virtual_root = NULL; |
9 | |
17 | |
10 | char *cgit_cache_root = "/var/cache/cgit"; |
18 | char *cgit_cache_root = "/var/cache/cgit"; |
11 | |
19 | |
12 | int cgit_max_lock_attempts = 5; |
20 | int cgit_max_lock_attempts = 5; |
13 | int cgit_cache_root_ttl = 5; |
21 | int cgit_cache_root_ttl = 5; |
14 | int cgit_cache_repo_ttl = 5; |
22 | int cgit_cache_repo_ttl = 5; |
15 | int cgit_cache_dynamic_ttl = 5; |
23 | int cgit_cache_dynamic_ttl = 5; |
16 | int cgit_cache_static_ttl = -1; |
24 | int cgit_cache_static_ttl = -1; |
17 | int cgit_cache_max_create_time = 5; |
25 | int cgit_cache_max_create_time = 5; |
18 | |
26 | |
19 | char *cgit_repo_name = NULL; |
27 | char *cgit_repo_name = NULL; |
20 | char *cgit_repo_desc = NULL; |
28 | char *cgit_repo_desc = NULL; |
21 | char *cgit_repo_owner = NULL; |
29 | char *cgit_repo_owner = NULL; |
22 | |
30 | |
23 | int cgit_query_has_symref = 0; |
31 | int cgit_query_has_symref = 0; |
24 | int cgit_query_has_sha1 = 0; |
32 | int cgit_query_has_sha1 = 0; |
25 | |
33 | |
26 | char *cgit_querystring = NULL; |
34 | char *cgit_querystring = NULL; |
27 | char *cgit_query_repo = NULL; |
35 | char *cgit_query_repo = NULL; |
28 | char *cgit_query_page = NULL; |
36 | char *cgit_query_page = NULL; |
29 | char *cgit_query_head = NULL; |
37 | char *cgit_query_head = NULL; |
30 | char *cgit_query_sha1 = NULL; |
38 | char *cgit_query_sha1 = NULL; |
31 | int cgit_query_ofs = 0; |
39 | int cgit_query_ofs = 0; |
32 | |
40 | |
33 | int htmlfd = 0; |
41 | int htmlfd = 0; |
34 | |
42 | |
35 | void cgit_global_config_cb(const char *name, const char *value) |
43 | void cgit_global_config_cb(const char *name, const char *value) |
36 | { |
44 | { |
37 | if (!strcmp(name, "root")) |
45 | if (!strcmp(name, "root")) |
38 | cgit_root = xstrdup(value); |
46 | cgit_root = xstrdup(value); |
39 | else if (!strcmp(name, "root-title")) |
47 | else if (!strcmp(name, "root-title")) |
40 | cgit_root_title = xstrdup(value); |
48 | cgit_root_title = xstrdup(value); |
41 | else if (!strcmp(name, "css")) |
49 | else if (!strcmp(name, "css")) |
42 | cgit_css = xstrdup(value); |
50 | cgit_css = xstrdup(value); |
43 | else if (!strcmp(name, "logo")) |
51 | else if (!strcmp(name, "logo")) |
44 | cgit_logo = xstrdup(value); |
52 | cgit_logo = xstrdup(value); |
45 | else if (!strcmp(name, "logo-link")) |
53 | else if (!strcmp(name, "logo-link")) |
46 | cgit_logo_link = xstrdup(value); |
54 | cgit_logo_link = xstrdup(value); |
47 | else if (!strcmp(name, "virtual-root")) |
55 | else if (!strcmp(name, "virtual-root")) |
48 | cgit_virtual_root = xstrdup(value); |
56 | cgit_virtual_root = xstrdup(value); |
49 | } |
57 | } |
50 | |
58 | |
51 | void cgit_repo_config_cb(const char *name, const char *value) |
59 | void cgit_repo_config_cb(const char *name, const char *value) |
52 | { |
60 | { |
53 | if (!strcmp(name, "name")) |
61 | if (!strcmp(name, "name")) |
54 | cgit_repo_name = xstrdup(value); |
62 | cgit_repo_name = xstrdup(value); |
55 | else if (!strcmp(name, "desc")) |
63 | else if (!strcmp(name, "desc")) |
56 | cgit_repo_desc = xstrdup(value); |
64 | cgit_repo_desc = xstrdup(value); |
57 | else if (!strcmp(name, "owner")) |
65 | else if (!strcmp(name, "owner")) |
58 | cgit_repo_owner = xstrdup(value); |
66 | cgit_repo_owner = xstrdup(value); |
59 | } |
67 | } |
60 | |
68 | |
61 | void cgit_querystring_cb(const char *name, const char *value) |
69 | void cgit_querystring_cb(const char *name, const char *value) |
62 | { |
70 | { |
63 | if (!strcmp(name,"r")) { |
71 | if (!strcmp(name,"r")) { |
64 | cgit_query_repo = xstrdup(value); |
72 | cgit_query_repo = xstrdup(value); |
65 | } else if (!strcmp(name, "p")) { |
73 | } else if (!strcmp(name, "p")) { |
66 | cgit_query_page = xstrdup(value); |
74 | cgit_query_page = xstrdup(value); |
67 | } else if (!strcmp(name, "h")) { |
75 | } else if (!strcmp(name, "h")) { |
68 | cgit_query_head = xstrdup(value); |
76 | cgit_query_head = xstrdup(value); |
69 | cgit_query_has_symref = 1; |
77 | cgit_query_has_symref = 1; |
70 | } else if (!strcmp(name, "id")) { |
78 | } else if (!strcmp(name, "id")) { |
71 | cgit_query_sha1 = xstrdup(value); |
79 | cgit_query_sha1 = xstrdup(value); |
72 | cgit_query_has_sha1 = 1; |
80 | cgit_query_has_sha1 = 1; |
73 | } else if (!strcmp(name, "ofs")) { |
81 | } else if (!strcmp(name, "ofs")) { |
74 | cgit_query_ofs = atoi(value); |
82 | cgit_query_ofs = atoi(value); |
75 | } |
83 | } |
76 | } |
84 | } |
77 | |
85 | |
|