summaryrefslogtreecommitdiffabout
authorLars Hjemli <hjemli@gmail.com>2009-08-19 15:47:24 (UTC)
committer Lars Hjemli <hjemli@gmail.com>2009-08-24 08:22:57 (UTC)
commit302a3efa261b1b6127b2a2189e25ab45019b1b54 (patch) (unidiff)
treeda2be8819777044cd16887da17528b1937be55ee
parent523a2161b9a21f5fa8526280bb914d7affb185b1 (diff)
downloadcgit-302a3efa261b1b6127b2a2189e25ab45019b1b54.zip
cgit-302a3efa261b1b6127b2a2189e25ab45019b1b54.tar.gz
cgit-302a3efa261b1b6127b2a2189e25ab45019b1b54.tar.bz2
cgit.c: make print_repolist() and print_repo() reusable for caching
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--cgit.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/cgit.c b/cgit.c
index 97f5e08..db96905 100644
--- a/cgit.c
+++ b/cgit.c
@@ -418,17 +418,17 @@ int cmp_repos(const void *a, const void *b)
418 418
419void print_repo(struct cgit_repo *repo) 419void print_repo(FILE *f, struct cgit_repo *repo)
420{ 420{
421 printf("repo.url=%s\n", repo->url); 421 fprintf(f, "repo.url=%s\n", repo->url);
422 printf("repo.name=%s\n", repo->name); 422 fprintf(f, "repo.name=%s\n", repo->name);
423 printf("repo.path=%s\n", repo->path); 423 fprintf(f, "repo.path=%s\n", repo->path);
424 if (repo->owner) 424 if (repo->owner)
425 printf("repo.owner=%s\n", repo->owner); 425 fprintf(f, "repo.owner=%s\n", repo->owner);
426 if (repo->desc) 426 if (repo->desc)
427 printf("repo.desc=%s\n", repo->desc); 427 fprintf(f, "repo.desc=%s\n", repo->desc);
428 if (repo->readme) 428 if (repo->readme)
429 printf("repo.readme=%s\n", repo->readme); 429 fprintf(f, "repo.readme=%s\n", repo->readme);
430 printf("\n"); 430 fprintf(f, "\n");
431} 431}
432 432
433void print_repolist(struct cgit_repolist *list) 433void print_repolist(FILE *f, struct cgit_repolist *list, int start)
434{ 434{
@@ -436,4 +436,4 @@ void print_repolist(struct cgit_repolist *list)
436 436
437 for(i = 0; i < list->count; i++) 437 for(i = start; i < list->count; i++)
438 print_repo(&list->repos[i]); 438 print_repo(f, &list->repos[i]);
439} 439}
@@ -484,3 +484,3 @@ static void cgit_parse_args(int argc, const char **argv)
484 sizeof(struct cgit_repo), cmp_repos); 484 sizeof(struct cgit_repo), cmp_repos);
485 print_repolist(&cgit_repolist); 485 print_repolist(stdout, &cgit_repolist, 0);
486 exit(0); 486 exit(0);