about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLars Hjemli <hjemli@gmail.com>2009-08-19 17:47:24 +0200
committerLars Hjemli <hjemli@gmail.com>2009-08-24 10:22:57 +0200
commit302a3efa261b1b6127b2a2189e25ab45019b1b54 (patch)
treeda2be8819777044cd16887da17528b1937be55ee
parentcache.h: export hash_str() (diff)
downloadcgit-pink-302a3efa261b1b6127b2a2189e25ab45019b1b54.tar.gz
cgit-pink-302a3efa261b1b6127b2a2189e25ab45019b1b54.zip
cgit.c: make print_repolist() and print_repo() reusable for caching
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
-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
@@ -416,26 +416,26 @@ int cmp_repos(const void *a, const void *b)
 	return strcmp(ra->url, rb->url);
 }
 
-void print_repo(struct cgit_repo *repo)
+void print_repo(FILE *f, struct cgit_repo *repo)
 {
-	printf("repo.url=%s\n", repo->url);
-	printf("repo.name=%s\n", repo->name);
-	printf("repo.path=%s\n", repo->path);
+	fprintf(f, "repo.url=%s\n", repo->url);
+	fprintf(f, "repo.name=%s\n", repo->name);
+	fprintf(f, "repo.path=%s\n", repo->path);
 	if (repo->owner)
-		printf("repo.owner=%s\n", repo->owner);
+		fprintf(f, "repo.owner=%s\n", repo->owner);
 	if (repo->desc)
-		printf("repo.desc=%s\n", repo->desc);
+		fprintf(f, "repo.desc=%s\n", repo->desc);
 	if (repo->readme)
-		printf("repo.readme=%s\n", repo->readme);
-	printf("\n");
+		fprintf(f, "repo.readme=%s\n", repo->readme);
+	fprintf(f, "\n");
 }
 
-void print_repolist(struct cgit_repolist *list)
+void print_repolist(FILE *f, struct cgit_repolist *list, int start)
 {
 	int i;
 
-	for(i = 0; i < list->count; i++)
-		print_repo(&list->repos[i]);
+	for(i = start; i < list->count; i++)
+		print_repo(f, &list->repos[i]);
 }
 
 
@@ -482,7 +482,7 @@ static void cgit_parse_args(int argc, const char **argv)
 	if (scan) {
 		qsort(cgit_repolist.repos, cgit_repolist.count,
 			sizeof(struct cgit_repo), cmp_repos);
-		print_repolist(&cgit_repolist);
+		print_repolist(stdout, &cgit_repolist, 0);
 		exit(0);
 	}
 }
amp;follow=1'>Add photos from October 5June McEnroe 2024-10-09Add photos from October 1June McEnroe Ok the first 3 are from September 29 but I didn't want to spoil the black and white roll. 2024-10-07Add photos from September 29June McEnroe 2024-10-07Add photos from September 28June McEnroe 2024-10-07Add photos from September 22June McEnroe 2024-09-25Add photos from September 15June McEnroe 2024-09-24Add photos from September 14June McEnroe 2024-09-24Add photos from September 12June McEnroe 2024-09-24Add photos from September 7June McEnroe 2024-09-24Allow not having descriptionsJune McEnroe I'm sorry, I can't keep writing descriptions. It makes posting photos take too long, I often don't know the words for what I'm looking at, and a good description is an entirely different work of art than the photo I took, and I'm just a photographer. It's visual art. 2024-09-23Automatically select the last used lens for a bodyJune McEnroe 2024-09-19Add photos from September 5June McEnroe Had to prefix the folder number onto these file names manually because they must have come out of a different scanner or something. 2024-09-15Add some more film stocks to the listJune McEnroe 2024-09-13Add photos from September 2June McEnroe 2024-09-13Add Fomapan 200 to films listJune McEnroe 2024-09-10Add August 29 picnic photosJune McEnroe 2024-09-08Apply some bold to trips renderingJune McEnroe This seems easier to visually scan. The only other thing I'd like is a nicer date rendering but JavaScript is useless for that. 2024-09-08Render trips hopefully more efficientlyJune McEnroe 2024-09-08Allow removing bodies and lensesJune McEnroe 2024-09-08Limit body width so it looks less silly on desktopJune McEnroe 2024-09-07Handle no film being loadedJune McEnroe 2024-09-07Fancy up the text a littleJune McEnroe