tm->tm_hour, tm->tm_min, tm->tm_sec);
}
-void cgit_print_error(const char *msg)
+void cgit_print_error(const char *fmt, ...)
{
+ va_list ap;
+ va_start(ap, fmt);
+ cgit_vprint_error(fmt, ap);
+ va_end(ap);
+}
+
+void cgit_vprint_error(const char *fmt, va_list ap)
+{
+ va_list cp;
html("<div class='error'>");
- html_txt(msg);
+ va_copy(cp, ap);
+ html_vtxtf(fmt, cp);
+ va_end(cp);
html("</div>\n");
}
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("/");