for (i=0; i<cgit_repolist.count; i++) {
repo = &cgit_repolist.repos[i];
if (!strcmp(repo->url, url))
for (i=0; i<cgit_repolist.count; i++) {
repo = &cgit_repolist.repos[i];
if (!strcmp(repo->url, url))
- item->name = xstrdup(fmt("%s/%s/%s/%s.html", cgit_cache_root,
- cgit_repo->url, cgit_query_page,
+ item->name = xstrdup(fmt("%s/%s/%s/%s.html", cgit_cache_root,
+ cgit_repo->url, cgit_query_page,
cache_safe_filename(cgit_querystring)));
if (cgit_query_has_symref)
item->ttl = cgit_cache_dynamic_ttl;
cache_safe_filename(cgit_querystring)));
if (cgit_query_has_symref)
item->ttl = cgit_cache_dynamic_ttl;
- cgit_print_snapshot(item, cgit_query_sha1, "zip",
+ cgit_print_snapshot(item, cgit_query_sha1, "zip",
if (!strcmp(cgit_query_page, "log")) {
cgit_print_log(cgit_query_head, cgit_query_ofs,
if (!strcmp(cgit_query_page, "log")) {
cgit_print_log(cgit_query_head, cgit_query_ofs,
} else if (!strcmp(cgit_query_page, "commit")) {
cgit_print_commit(cgit_query_sha1);
} else if (!strcmp(cgit_query_page, "view")) {
} else if (!strcmp(cgit_query_page, "commit")) {
cgit_print_commit(cgit_query_sha1);
} else if (!strcmp(cgit_query_page, "view")) {
"Preserving STDOUT");
chk_zero(close(STDOUT_FILENO), "Closing STDOUT");
chk_positive(dup2(item->fd, STDOUT_FILENO), "Dup2(cachefile)");
"Preserving STDOUT");
chk_zero(close(STDOUT_FILENO), "Closing STDOUT");
chk_positive(dup2(item->fd, STDOUT_FILENO), "Dup2(cachefile)");
"Restoring original STDOUT");
chk_zero(close(stdout2), "Closing temporary STDOUT");
}
"Restoring original STDOUT");
chk_zero(close(stdout2), "Closing temporary STDOUT");
}
- cgit_read_config("/etc/cgitrc", cgit_global_config_cb);
+ cgit_read_config(CGIT_CONFIG, cgit_global_config_cb);
+ if (getenv("SCRIPT_NAME"))
+ cgit_script_name = xstrdup(getenv("SCRIPT_NAME"));
if (getenv("QUERY_STRING"))
cgit_querystring = xstrdup(getenv("QUERY_STRING"));
cgit_parse_args(argc, argv);
if (getenv("QUERY_STRING"))
cgit_querystring = xstrdup(getenv("QUERY_STRING"));
cgit_parse_args(argc, argv);