repo

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 6652abe7cecd4d2cbaa54939be7dc492041e0906
parent 88f39d240294f086e3fb6d3155cfb398d273038e
Author: z3bra <willyatmailoodotorg>
Date:   Sat Dec 10 10:31:04 +0100

Encode URLs for download

Diffstat:
repo.c | 9+++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/repo.c b/repo.c @@ -105,7 +105,7 @@ local_load(struct packs *plist, char *local) if (!list) { perror(fn); free(fn); - return -1; + exit(1); } while (fgets(buf, LINE_MAX, list)) { @@ -167,14 +167,14 @@ remote_sync(char *remote, char *local, char *file) snprintf(url, len + 1, "%s%s", remote, enc); url[len] = 0; - len = strlen(local) + strlen(enc); + len = strlen(local) + strlen(file); fn = malloc(len + 1); if (!fn) { perror("malloc"); ret = 1; goto synccleanup; } - snprintf(fn, len + 1, "%s%s", local, enc); + snprintf(fn, len + 1, "%s%s", local, file); fn[len] = 0; list = fopen(fn, "w"); if (!list) { @@ -218,12 +218,13 @@ main (int argc, char *argv[]) usage(argv0); }ARGEND; + local_load(&plist, LOCALREPO); while ((n = *(argv++))) { - local_load(&plist, LOCALREPO); SLIST_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; } } }