repo

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

commit 782e12892286906e5cb3c244d96959725342dbb2
parent 849be1f67dcdad023ac817558bf918606a3acf35
Author: z3bra <contactatz3bradotorg>
Date:   Fri Dec 16 10:20:12 +0100

Allow forcing download of a remote file

Diffstat:
repo.c | 11++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/repo.c b/repo.c @@ -22,7 +22,7 @@ int verbose = 0; void usage(char *name) { - fprintf(stderr, "usage: %s [-sl] [-c FILE] [-r URL] [PACK..]\n", name); + fprintf(stderr, "usage: %s [-c FILE] [-fls] [-r URL] [PACK..]\n", name); exit(1); } @@ -139,7 +139,7 @@ download(char *url, FILE *fd) int main (int argc, char *argv[]) { - int sflag = 0, lflag = 0; + int fflag, lflag, sflag; char *argv0, *n; char cfgfile[PATH_MAX] = DEFCFGFILE; char fn[PATH_MAX], url[PATH_MAX]; @@ -153,10 +153,15 @@ main (int argc, char *argv[]) TAILQ_INIT(&plist); TAILQ_INIT(&rlist); + fflag = lflag = sflag = 0; + ARGBEGIN{ case 'c': snprintf(cfgfile, PATH_MAX, "%s", EARGF(usage(argv0))); break; + case 'f': + fflag = 1; + break; case 'r': addrepo(&rlist, EARGF(usage(argv0))); break; @@ -204,7 +209,7 @@ main (int argc, char *argv[]) TAILQ_FOREACH(p, &plist, entries) { if (!strncmp(p->name, n, PATH_MAX)) { snprintf(fn, PATH_MAX, "%s/%s", DEFLOCALREPO, basename(p->url)); - if (!stat(fn, &sb)) { + if (!stat(fn, &sb) && !fflag) { puts(fn); continue; }