tEncode URLs for download - repo - list/download/sync packs with remote repositories
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
---
(DIR) commit 6652abe7cecd4d2cbaa54939be7dc492041e0906
(DIR) parent 88f39d240294f086e3fb6d3155cfb398d273038e
(HTM) Author: z3bra <willyatmailoodotorg>
Date: Sat, 10 Dec 2016 10:31:04 +0100
Encode URLs for download
Diffstat:
M repo.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
---
(DIR) diff --git a/repo.c b/repo.c
t@@ -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)) {
t@@ -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) {
t@@ -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;
}
}
}