summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--cgit.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/cgit.c b/cgit.c
index d9a03c2..1281bfa 100644
--- a/cgit.c
+++ b/cgit.c
@@ -217,24 +217,26 @@ static void cgit_parse_args(int argc, const char **argv)
217 cgit_query_ofs = atoi(argv[i]+6); 217 cgit_query_ofs = atoi(argv[i]+6);
218 } 218 }
219 } 219 }
220} 220}
221 221
222int main(int argc, const char **argv) 222int main(int argc, const char **argv)
223{ 223{
224 struct cacheitem item; 224 struct cacheitem item;
225 const char *cgit_config_env = getenv("CGIT_CONFIG");
225 226
226 htmlfd = STDOUT_FILENO; 227 htmlfd = STDOUT_FILENO;
227 item.st.st_mtime = time(NULL); 228 item.st.st_mtime = time(NULL);
228 cgit_repolist.length = 0; 229 cgit_repolist.length = 0;
229 cgit_repolist.count = 0; 230 cgit_repolist.count = 0;
230 cgit_repolist.repos = NULL; 231 cgit_repolist.repos = NULL;
231 232
232 cgit_read_config(CGIT_CONFIG, cgit_global_config_cb); 233 cgit_read_config(cgit_config_env ? cgit_config_env : CGIT_CONFIG,
234 cgit_global_config_cb);
233 cgit_repo = NULL; 235 cgit_repo = NULL;
234 if (getenv("SCRIPT_NAME")) 236 if (getenv("SCRIPT_NAME"))
235 cgit_script_name = xstrdup(getenv("SCRIPT_NAME")); 237 cgit_script_name = xstrdup(getenv("SCRIPT_NAME"));
236 if (getenv("QUERY_STRING")) 238 if (getenv("QUERY_STRING"))
237 cgit_querystring = xstrdup(getenv("QUERY_STRING")); 239 cgit_querystring = xstrdup(getenv("QUERY_STRING"));
238 cgit_parse_args(argc, argv); 240 cgit_parse_args(argc, argv);
239 cgit_parse_query(cgit_querystring, cgit_querystring_cb); 241 cgit_parse_query(cgit_querystring, cgit_querystring_cb);
240 if (!cgit_prepare_cache(&item)) 242 if (!cgit_prepare_cache(&item))