summaryrefslogtreecommitdiffabout
path: root/ui-shared.c
authorLars Hjemli <hjemli@gmail.com>2007-05-14 22:48:31 (UTC)
committer Lars Hjemli <hjemli@gmail.com>2007-05-14 22:48:31 (UTC)
commitea2831f1c826d92c0158474c2d07837ec2f9fd6c (patch) (side-by-side diff)
treee8d6a89bf0f50835f9c86dd642e7906e1d050df7 /ui-shared.c
parent6fb7d09fea94b3dd6932469283358cb24f1e7e29 (diff)
downloadcgit-ea2831f1c826d92c0158474c2d07837ec2f9fd6c.zip
cgit-ea2831f1c826d92c0158474c2d07837ec2f9fd6c.tar.gz
cgit-ea2831f1c826d92c0158474c2d07837ec2f9fd6c.tar.bz2
Don't hardcode urls when SCRIPT_NAME is available
Also, let the makefile define the name of the installed cgi and use that definition as a default value for cgit_script_name variable. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Diffstat (limited to 'ui-shared.c') (more/less context) (show whitespace changes)
-rw-r--r--ui-shared.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ui-shared.c b/ui-shared.c
index 6f5cf2b..b0cff7d 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -24,75 +24,75 @@ static char *http_date(time_t t)
tm->tm_mday, month[tm->tm_mon], 1900+tm->tm_year,
tm->tm_hour, tm->tm_min, tm->tm_sec);
}
static long ttl_seconds(long ttl)
{
if (ttl<0)
return 60 * 60 * 24 * 365;
else
return ttl * 60;
}
void cgit_print_error(char *msg)
{
html("<div class='error'>");
html_txt(msg);
html("</div>\n");
}
char *cgit_rooturl()
{
if (cgit_virtual_root)
return fmt("%s/", cgit_virtual_root);
else
- return "./cgit.cgi";
+ return cgit_script_name;
}
char *cgit_repourl(const char *reponame)
{
if (cgit_virtual_root) {
return fmt("%s/%s/", cgit_virtual_root, reponame);
} else {
return fmt("?r=%s", reponame);
}
}
char *cgit_pageurl(const char *reponame, const char *pagename,
const char *query)
{
if (cgit_virtual_root) {
return fmt("%s/%s/%s/?%s", cgit_virtual_root, reponame,
pagename, query);
} else {
return fmt("?r=%s&p=%s&%s", reponame, pagename, query);
}
}
char *cgit_currurl()
{
if (!cgit_virtual_root)
- return "./cgit.cgi";
+ return cgit_script_name;
else if (cgit_query_page)
return fmt("%s/%s/%s/", cgit_virtual_root, cgit_query_repo, cgit_query_page);
else if (cgit_query_repo)
return fmt("%s/%s/", cgit_virtual_root, cgit_query_repo);
else
return fmt("%s/", cgit_virtual_root);
}
void cgit_print_date(unsigned long secs)
{
char buf[32];
struct tm *time;
time = gmtime(&secs);
strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", time);
html_txt(buf);
}
void cgit_print_docstart(char *title, struct cacheitem *item)
{
html("Content-Type: text/html; charset=utf-8\n");
htmlf("Last-Modified: %s\n", http_date(item->st.st_mtime));
htmlf("Expires: %s\n", http_date(item->st.st_mtime +