*/
#include "cgit.h"
+#include "ui-shared.h"
#include "cmd.h"
#include "html.h"
html("</div>\n");
}
-char *cgit_httpscheme()
+const char *cgit_httpscheme()
{
if (ctx.env.https && !strcmp(ctx.env.https, "on"))
return "https://";
return "http://";
}
-char *cgit_hosturl()
+const char *cgit_hosturl()
{
if (ctx.env.http_host)
return ctx.env.http_host;
return xstrdup(fmt("%s:%s", ctx.env.server_name, ctx.env.server_port));
}
-char *cgit_rooturl()
+const char *cgit_rooturl()
{
if (ctx.cfg.virtual_root)
- return fmt("%s/", ctx.cfg.virtual_root);
+ return ctx.cfg.virtual_root;
else
return ctx.cfg.script_name;
}
char *cgit_repourl(const char *reponame)
{
if (ctx.cfg.virtual_root) {
- return fmt("%s/%s/", ctx.cfg.virtual_root, reponame);
+ return fmt("%s%s/", ctx.cfg.virtual_root, reponame);
} else {
return fmt("?r=%s", reponame);
}
char *delim;
if (ctx.cfg.virtual_root) {
- tmp = fmt("%s/%s/%s/%s", ctx.cfg.virtual_root, reponame,
+ tmp = fmt("%s%s/%s/%s", ctx.cfg.virtual_root, reponame,
pagename, (filename ? filename:""));
delim = "?";
} else {
{
char *delim = "?";
- if (ctx.cfg.virtual_root) {
+ if (ctx.cfg.virtual_root)
html_attr(ctx.cfg.virtual_root);
- if (ctx.cfg.virtual_root[strlen(ctx.cfg.virtual_root) - 1] != '/')
- html("/");
- } else
+ else
html(ctx.cfg.script_name);
if (page) {
html(" href='");
if (ctx.cfg.virtual_root) {
html_url_path(ctx.cfg.virtual_root);
- if (ctx.cfg.virtual_root[strlen(ctx.cfg.virtual_root) - 1] != '/')
- html("/");
html_url_path(ctx.repo->url);
if (ctx.repo->url[strlen(ctx.repo->url) - 1] != '/')
html("/");
return;
}
- char *host = cgit_hosturl();
+ const char *host = cgit_hosturl();
html(cgit_doctype);
html("<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'>\n");
html("<head>\n");