diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2009-02-17 12:23:01 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2009-02-17 12:23:01 +0000 |
commit | ca51ec323839598928fca85cec3bd3109fd32658 (patch) | |
tree | 8254fcc74770eff26c1e27576d4acb6313224b0a /src/apk.c | |
parent | 6e55a18269f12458608d1259dd4b6391f48db3e2 (diff) | |
download | apk-tools-ca51ec323839598928fca85cec3bd3109fd32658.tar.gz apk-tools-ca51ec323839598928fca85cec3bd3109fd32658.tar.bz2 apk-tools-ca51ec323839598928fca85cec3bd3109fd32658.tar.xz apk-tools-ca51ec323839598928fca85cec3bd3109fd32658.zip |
db: allow more than one --repository arg
Diffstat (limited to 'src/apk.c')
-rw-r--r-- | src/apk.c | 19 |
1 files changed, 17 insertions, 2 deletions
@@ -22,7 +22,7 @@ #include "apk_applet.h" const char *apk_root; -const char *apk_repository = NULL; +struct apk_repository_url apk_repository_list; int apk_verbosity = 1, apk_progress = 0, apk_upgrade = 0; int apk_cwd_fd; @@ -99,6 +99,17 @@ static struct apk_applet *deduce_applet(int argc, char **argv) return NULL; } +static struct apk_repository_url *apk_repository_new(const char *url) +{ + struct apk_repository_url *r = calloc(1, + sizeof(struct apk_repository_url)); + if (r) { + r->url = url; + list_init(&r->list); + } + return r; +} + #define NUM_GENERIC_OPTS 6 static struct option generic_options[32] = { { "root", required_argument, NULL, 'p' }, @@ -116,10 +127,12 @@ int main(int argc, char **argv) struct option *opt; int r, optindex; void *ctx = NULL; + struct apk_repository_url *repo = NULL; umask(0); apk_cwd_fd = open(".", O_RDONLY); apk_root = getenv("ROOT"); + list_init(&apk_repository_list.list); applet = deduce_applet(argc, argv); if (applet != NULL) { @@ -151,7 +164,9 @@ int main(int argc, char **argv) apk_root = optarg; break; case 'X': - apk_repository = optarg; + repo = apk_repository_new(optarg); + if (repo) + list_add(&repo->list, &apk_repository_list.list); break; case 'q': apk_verbosity--; |