repo

List, download and sync packs with remote repositories
Log | Files | Refs

commit 1d72afb000e9e17e819f142023034a6efc344aef
parent 268212a0aea3fae8f59c6484866fe33fab2a2638
Author: z3bra <contactatz3bradotorg>
Date:   Thu Dec 15 11:26:00 +0100

Makes repos a tailq linked-list

Diffstat:
repo.c | 29+++++++++++++++++++++++++++++
1 file changed, 29 insertions(+), 0 deletions(-)
diff --git a/repo.c b/repo.c @@ -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 *); @@ -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) {