index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
author | Dan McGee <dan@archlinux.org> | 2011-06-07 16:06:16 -0500 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2011-06-13 19:38:38 -0500 |
commit | e2aa952689da8763d534d1c19310eb97009f4f76 (patch) | |
tree | 7d022d67801bc01c24fef985feb9a617c48d316a /src/util/pactree.c | |
parent | 8b62d9bc0ade64897990b8fc6a1b6a54b629cb5b (diff) |
-rw-r--r-- | src/util/pactree.c | 30 |
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]; |