summaryrefslogtreecommitdiffabout
path: root/scan-tree.c
Side-by-side diff
Diffstat (limited to 'scan-tree.c') (more/less context) (ignore whitespace changes)
-rw-r--r--scan-tree.c19
1 files changed, 5 insertions, 14 deletions
diff --git a/scan-tree.c b/scan-tree.c
index 47f3988..4da21a4 100644
--- a/scan-tree.c
+++ b/scan-tree.c
@@ -37,15 +37,2 @@ static int is_git_dir(const char *path)
-char *readfile(const char *path)
-{
- FILE *f;
- static char buf[MAX_PATH];
-
- if (!(f = fopen(path, "r")))
- return NULL;
- buf[0] = 0;
- fgets(buf, MAX_PATH, f);
- fclose(f);
- return buf;
-}
-
static void add_repo(const char *base, const char *path)
@@ -56,2 +43,3 @@ static void add_repo(const char *base, const char *path)
char *p;
+ size_t size;
@@ -78,2 +66,5 @@ static void add_repo(const char *base, const char *path)
repo->path = xstrdup(path);
+ p = (pwd && pwd->pw_gecos) ? strchr(pwd->pw_gecos, ',') : NULL;
+ if (p)
+ *p = '\0';
repo->owner = (pwd ? xstrdup(pwd->pw_gecos ? pwd->pw_gecos : pwd->pw_name) : "");
@@ -82,3 +73,3 @@ static void add_repo(const char *base, const char *path)
if (!stat(p, &st))
- repo->desc = xstrdup(readfile(p));
+ readfile(p, &repo->desc, &size);