tMakes repos a tailq linked-list - repo - list/download/sync packs with remote repositories
DIR Log
DIR Files
DIR Refs
DIR README
---
DIR commit 1d72afb000e9e17e819f142023034a6efc344aef
DIR parent 268212a0aea3fae8f59c6484866fe33fab2a2638
HTML Author: z3bra <contactatz3bradotorg>
Date: Thu, 15 Dec 2016 11:26:00 +0100
Makes repos a tailq linked-list
Diffstat:
M repo.c | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+), 0 deletions(-)
---
DIR diff --git a/repo.c b/repo.c
t@@ -22,8 +22,15 @@ struct pack {
};
TAILQ_HEAD(packs, pack);
+struct repo {
+ char *url;
+ TAILQ_ENTRY(repo) entries;
+};
+TAILQ_HEAD(repos, repo);
+
void usage(char *);
struct pack *pack_load(char *);
+struct repo *add_repo(struct repos *, char *);
int local_load(struct packs *, char *);
int local_list(char *);
int remote_sync(char *, char *, char *);
t@@ -57,6 +64,28 @@ pack_load(char *repoline)
return p;
}
+struct repo *
+add_repo(struct repos *rlist, char *url)
+{
+ struct repo *r = NULL;
+
+ r = malloc(sizeof(struct repo));
+ if (!r) {
+ perror("malloc");
+ exit(1);
+ }
+
+ r->url = strdup(url);
+ if (!r->url) {
+ perror("malloc");
+ exit(1);
+ }
+
+ TAILQ_INSERT_TAIL(rlist, r, entries);
+
+ return r;
+}
+
int
local_load(struct packs *plist, char *local)
{