+struct cgit_repo *repo;
+repo_config_fn config_fn;
+
+static void repo_config(const char *name, const char *value)
+{
+ config_fn(repo, name, value);
+}
+
+static int gitconfig_config(const char *key, const char *value, void *cb)
+{
+ if (!strcmp(key, "gitweb.owner"))
+ config_fn(repo, "owner", value);
+ else if (!strcmp(key, "gitweb.description"))
+ config_fn(repo, "desc", value);
+ else if (!strcmp(key, "gitweb.category"))
+ config_fn(repo, "section", value);
+ else if (!prefixcmp(key, "cgit."))
+ config_fn(repo, key + 5, value);
+
+ return 0;
+}
+
+static char *xstrrchr(char *s, char *from, int c)
+{
+ while (from >= s && *from != c)
+ from--;
+ return from < s ? NULL : from;
+}
+
+static void add_repo(const char *base, const char *path, repo_config_fn fn)