-rw-r--r-- | ui-shared.c | 22 | ||||
-rw-r--r-- | ui-shared.h | 2 |
2 files changed, 19 insertions, 5 deletions
diff --git a/ui-shared.c b/ui-shared.c index d08ede9..f366354 100644 --- a/ui-shared.c +++ b/ui-shared.c @@ -115,5 +115,5 @@ char *cgit_currurl() } -static void site_url(char *page, char *search) +static void site_url(char *page, char *search, int ofs) { char *delim = "?"; @@ -134,9 +134,14 @@ static void site_url(char *page, char *search) html("q="); html_attr(search); + delim = "&"; + } + if (ofs) { + html(delim); + htmlf("ofs=%d", ofs); } } static void site_link(char *page, char *name, char *title, char *class, - char *search) + char *search, int ofs) { html("<a"); @@ -152,5 +157,5 @@ static void site_link(char *page, char *name, char *title, char *class, } html(" href='"); - site_url(page, search); + site_url(page, search, ofs); html("'>"); html_txt(name); @@ -158,4 +163,10 @@ static void site_link(char *page, char *name, char *title, char *class, } +void cgit_index_link(char *name, char *title, char *class, char *pattern, + int ofs) +{ + site_link(NULL, name, title, class, pattern, ofs); +} + static char *repolink(char *title, char *class, char *page, char *head, char *path) @@ -597,7 +608,8 @@ void cgit_print_pageheader(struct cgit_context *ctx) html("</form>\n"); } else { - site_link(NULL, "index", NULL, hc(cmd, "repolist"), NULL); + site_link(NULL, "index", NULL, hc(cmd, "repolist"), NULL, 0); if (ctx->cfg.root_readme) - site_link("about", "about", NULL, hc(cmd, "about"), NULL); + site_link("about", "about", NULL, hc(cmd, "about"), + NULL, 0); html("</td><td class='form'>"); html("<form method='get' action='"); diff --git a/ui-shared.h b/ui-shared.h index 76c2b1f..3005d30 100644 --- a/ui-shared.h +++ b/ui-shared.h @@ -8,4 +8,6 @@ extern char *cgit_pageurl(const char *reponame, const char *pagename, const char *query); +extern void cgit_index_link(char *name, char *title, char *class, + char *pattern, int ofs); extern void cgit_tree_link(char *name, char *title, char *class, char *head, char *rev, char *path); |