summaryrefslogtreecommitdiffabout
path: root/shared.c
Unidiff
Diffstat (limited to 'shared.c') (more/less context) (ignore whitespace changes)
-rw-r--r--shared.c8
1 files changed, 8 insertions, 0 deletions
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
3char *cgit_root = "/usr/src/git"; 11char *cgit_root = "/usr/src/git";
4char *cgit_root_title = "Git repository browser"; 12char *cgit_root_title = "Git repository browser";
5char *cgit_css = "/cgit.css"; 13char *cgit_css = "/cgit.css";
6char *cgit_logo = "/git-logo.png"; 14char *cgit_logo = "/git-logo.png";
7char *cgit_logo_link = "http://www.kernel.org/pub/software/scm/git/docs/"; 15char *cgit_logo_link = "http://www.kernel.org/pub/software/scm/git/docs/";
8char *cgit_virtual_root = NULL; 16char *cgit_virtual_root = NULL;
9 17
10char *cgit_cache_root = "/var/cache/cgit"; 18char *cgit_cache_root = "/var/cache/cgit";
11 19
12int cgit_max_lock_attempts = 5; 20int cgit_max_lock_attempts = 5;
13int cgit_cache_root_ttl = 5; 21int cgit_cache_root_ttl = 5;
14int cgit_cache_repo_ttl = 5; 22int cgit_cache_repo_ttl = 5;
15int cgit_cache_dynamic_ttl = 5; 23int cgit_cache_dynamic_ttl = 5;
16int cgit_cache_static_ttl = -1; 24int cgit_cache_static_ttl = -1;
17int cgit_cache_max_create_time = 5; 25int cgit_cache_max_create_time = 5;
18 26
19char *cgit_repo_name = NULL; 27char *cgit_repo_name = NULL;
20char *cgit_repo_desc = NULL; 28char *cgit_repo_desc = NULL;
21char *cgit_repo_owner = NULL; 29char *cgit_repo_owner = NULL;
22 30
23int cgit_query_has_symref = 0; 31int cgit_query_has_symref = 0;
24int cgit_query_has_sha1 = 0; 32int cgit_query_has_sha1 = 0;
25 33
26char *cgit_querystring = NULL; 34char *cgit_querystring = NULL;
27char *cgit_query_repo = NULL; 35char *cgit_query_repo = NULL;
28char *cgit_query_page = NULL; 36char *cgit_query_page = NULL;
29char *cgit_query_head = NULL; 37char *cgit_query_head = NULL;
30char *cgit_query_sha1 = NULL; 38char *cgit_query_sha1 = NULL;
31int cgit_query_ofs = 0; 39int cgit_query_ofs = 0;
32 40
33int htmlfd = 0; 41int htmlfd = 0;
34 42
35void cgit_global_config_cb(const char *name, const char *value) 43void 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
51void cgit_repo_config_cb(const char *name, const char *value) 59void 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
61void cgit_querystring_cb(const char *name, const char *value) 69void 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