diff options
author | Lars Hjemli | 2006-12-11 17:25:41 +0100 |
---|---|---|
committer | Lars Hjemli | 2006-12-11 17:25:51 +0100 |
commit | 44923f8953c66dc9b852316b655ab3b5aec9478e (patch) | |
tree | e129ec8db3f8ffcf7f82f94052f430e576a9714c /shared.c | |
parent | df63119302910587e280d91dce67f6537a671f74 (diff) | |
download | cgit-44923f8953c66dc9b852316b655ab3b5aec9478e.tar.gz cgit-44923f8953c66dc9b852316b655ab3b5aec9478e.tar.bz2 cgit-44923f8953c66dc9b852316b655ab3b5aec9478e.zip |
Move global variables + callback functions into shared.c
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Diffstat (limited to 'shared.c')
-rw-r--r-- | shared.c | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/shared.c b/shared.c new file mode 100644 index 0000000..c58a2ff --- /dev/null +++ b/shared.c | |||
@@ -0,0 +1,74 @@ | |||
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 | |||
32 | int htmlfd = 0; | ||
33 | |||
34 | void 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 | |||
50 | void 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 | |||
60 | void 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 | |||