repo

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

commit b7ea949712bf597433985871df74f03857f52e03
parent 1d72afb000e9e17e819f142023034a6efc344aef
Author: z3bra <contactatz3bradotorg>
Date:   Thu Dec 15 16:37:50 +0100

Change pack struct to replace filename with url

Diffstat:
repo.c | 13+++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/repo.c b/repo.c @@ -1,4 +1,5 @@ #include <errno.h> +#include <libgen.h> #include <limits.h> #include <stdio.h> #include <stdlib.h> @@ -11,13 +12,13 @@ #include "arg.h" #define LISTFILE ".list" -#define LOCALREPO "local/" -#define REMOTEREPO "http://127.0.0.1/" +#define LOCALREPO "local" +#define REMOTEREPO "http://127.0.0.1/pack" struct pack { char name[LINE_MAX]; char version[LINE_MAX]; - char filename[PATH_MAX]; + char url[PATH_MAX]; TAILQ_ENTRY(pack) entries; }; TAILQ_HEAD(packs, pack); @@ -54,7 +55,7 @@ pack_load(char *repoline) return NULL; } - r = sscanf(repoline, "%s\t%s\t%s", p->name, p->version, p->filename); + r = sscanf(repoline, "%s\t%s\t%s", p->name, p->version, p->url); if (r < 3) { fprintf(stderr, "error parsing line: %s\n", repoline); free(p); @@ -195,6 +196,8 @@ main (int argc, char *argv[]) struct packs plist; struct pack *p = NULL; + TAILQ_INIT(&plist); + ARGBEGIN{ case 's': remote_sync(REMOTEREPO, LOCALREPO, LISTFILE); @@ -211,8 +214,6 @@ main (int argc, char *argv[]) while ((n = *(argv++))) { TAILQ_FOREACH(p, &plist, entries) { if (!strncmp(p->name, n, PATH_MAX)) { - remote_sync(REMOTEREPO, LOCALREPO, p->filename); - printf("%s%s\n", LOCALREPO, p->filename); break; } }