summaryrefslogtreecommitdiffabout
path: root/cgit.c
Unidiff
Diffstat (limited to 'cgit.c') (more/less context) (ignore whitespace changes)
-rw-r--r--cgit.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/cgit.c b/cgit.c
index 67ad103..3c11ff0 100644
--- a/cgit.c
+++ b/cgit.c
@@ -231,30 +231,32 @@ static void cgit_parse_args(int argc, const char **argv)
231 cgit_query_ofs = atoi(argv[i]+6); 231 cgit_query_ofs = atoi(argv[i]+6);
232 } 232 }
233 } 233 }
234} 234}
235 235
236int main(int argc, const char **argv) 236int main(int argc, const char **argv)
237{ 237{
238 struct cacheitem item; 238 struct cacheitem item;
239 239
240 htmlfd = STDOUT_FILENO; 240 htmlfd = STDOUT_FILENO;
241 item.st.st_mtime = time(NULL); 241 item.st.st_mtime = time(NULL);
242 cgit_repolist.length = 0; 242 cgit_repolist.length = 0;
243 cgit_repolist.count = 0; 243 cgit_repolist.count = 0;
244 cgit_repolist.repos = NULL; 244 cgit_repolist.repos = NULL;
245 245
246 cgit_read_config(CGIT_CONFIG, cgit_global_config_cb); 246 cgit_read_config(CGIT_CONFIG, cgit_global_config_cb);
247 if (getenv("SCRIPT_NAME"))
248 cgit_script_name = xstrdup(getenv("SCRIPT_NAME"));
247 if (getenv("QUERY_STRING")) 249 if (getenv("QUERY_STRING"))
248 cgit_querystring = xstrdup(getenv("QUERY_STRING")); 250 cgit_querystring = xstrdup(getenv("QUERY_STRING"));
249 cgit_parse_args(argc, argv); 251 cgit_parse_args(argc, argv);
250 cgit_parse_query(cgit_querystring, cgit_querystring_cb); 252 cgit_parse_query(cgit_querystring, cgit_querystring_cb);
251 if (!cgit_prepare_cache(&item)) 253 if (!cgit_prepare_cache(&item))
252 return 0; 254 return 0;
253 if (cgit_nocache) { 255 if (cgit_nocache) {
254 cgit_fill_cache(&item, 0); 256 cgit_fill_cache(&item, 0);
255 } else { 257 } else {
256 cgit_check_cache(&item); 258 cgit_check_cache(&item);
257 cgit_print_cache(&item); 259 cgit_print_cache(&item);
258 } 260 }
259 return 0; 261 return 0;
260} 262}