+
+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";
+ 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);
+
+}
+