Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/src/util/pactree.c
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-06-07 16:06:16 -0500
committerDan McGee <dan@archlinux.org>2011-06-13 19:38:38 -0500
commite2aa952689da8763d534d1c19310eb97009f4f76 (patch)
tree7d022d67801bc01c24fef985feb9a617c48d316a /src/util/pactree.c
parent8b62d9bc0ade64897990b8fc6a1b6a54b629cb5b (diff)
Move pm_errno onto the handle
This involves some serious changes and a very messy diff, unfortunately. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'src/util/pactree.c')
-rw-r--r--src/util/pactree.c30
1 files changed, 11 insertions, 19 deletions
diff --git a/src/util/pactree.c b/src/util/pactree.c
index 6c869426..1dee61bf 100644
--- a/src/util/pactree.c
+++ b/src/util/pactree.c
@@ -88,19 +88,6 @@ int reverse = 0;
int unique = 0;
const char *dbpath = DBPATH;
-static int alpm_local_init(void)
-{
- enum _pmerrno_t err;
-
- handle = alpm_initialize(ROOTDIR, dbpath, &err);
- if(!handle) {
- return -1;
- }
-
- db_local = alpm_option_get_localdb(handle);
- return 0;
-}
-
static int parse_options(int argc, char *argv[])
{
int opt, option_index = 0;
@@ -327,22 +314,27 @@ static void walk_deps(pmpkg_t *pkg, int depth)
int main(int argc, char *argv[])
{
- int ret;
+ int ret = 0;
+ enum _pmerrno_t err;
const char *target_name;
pmpkg_t *pkg;
- ret = parse_options(argc, argv);
- if(ret != 0) {
+ if(parse_options(argc, argv) != 0) {
usage();
+ ret = 1;
goto finish;
}
- ret = alpm_local_init();
- if(ret != 0) {
- fprintf(stderr, "error: cannot initialize alpm: %s\n", alpm_strerrorlast());
+ handle = alpm_initialize(ROOTDIR, dbpath, &err);
+ if(!handle) {
+ fprintf(stderr, "error: cannot initialize alpm: %s\n",
+ alpm_strerror(err));
+ ret = 1;
goto finish;
}
+ db_local = alpm_option_get_localdb(handle);
+
/* we only care about the first non option arg for walking */
target_name = argv[optind];