|
|
@ -751,31 +751,19 @@ void cgit_print_docend() |
|
|
|
|
|
|
|
|
|
|
|
static void add_clone_urls(void (*fn)(const char *), char *txt, char *suffix) |
|
|
|
static void add_clone_urls(void (*fn)(const char *), char *txt, char *suffix) |
|
|
|
{ |
|
|
|
{ |
|
|
|
struct strbuf buf = STRBUF_INIT; |
|
|
|
struct strbuf **url_list = strbuf_split_str(txt, ' ', 0); |
|
|
|
char *h = txt, *t, c; |
|
|
|
int i; |
|
|
|
|
|
|
|
|
|
|
|
while (h && *h) { |
|
|
|
for (i = 0; url_list[i]; i++) { |
|
|
|
while (h && *h == ' ') |
|
|
|
strbuf_rtrim(url_list[i]); |
|
|
|
h++; |
|
|
|
if (url_list[i]->len == 0) |
|
|
|
if (!*h) |
|
|
|
continue; |
|
|
|
break; |
|
|
|
if (suffix && *suffix) |
|
|
|
t = h; |
|
|
|
strbuf_addf(url_list[i], "/%s", suffix); |
|
|
|
while (t && *t && *t != ' ') |
|
|
|
fn(url_list[i]->buf); |
|
|
|
t++; |
|
|
|
|
|
|
|
c = *t; |
|
|
|
|
|
|
|
*t = 0; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (suffix && *suffix) { |
|
|
|
|
|
|
|
strbuf_reset(&buf); |
|
|
|
|
|
|
|
strbuf_addf(&buf, "%s/%s", h, suffix); |
|
|
|
|
|
|
|
h = buf.buf; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
fn(h); |
|
|
|
|
|
|
|
*t = c; |
|
|
|
|
|
|
|
h = t; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
strbuf_release(&buf); |
|
|
|
strbuf_list_free(url_list); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void cgit_add_clone_urls(void (*fn)(const char *)) |
|
|
|
void cgit_add_clone_urls(void (*fn)(const char *)) |
|
|
|