index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
-rw-r--r-- | src/pacman/query.c | 28 | ||||
-rw-r--r-- | src/pacman/sync.c | 5 |
diff --git a/src/pacman/query.c b/src/pacman/query.c index 4abb674d..57850e8f 100644 --- a/src/pacman/query.c +++ b/src/pacman/query.c @@ -120,14 +120,14 @@ int pacman_query(alpm_list_t *targets) alpm_list_t *sync_dbs = NULL, *i, *j, *k; pmpkg_t *info = NULL; char *package = NULL; - int done = 0; + int ret = 0; if(config->op_q_search) { - alpm_list_t *ret = alpm_db_search(db_local, targets); - if(ret == NULL) { + alpm_list_t *searchlist = alpm_db_search(db_local, targets); + if(searchlist == NULL) { return(0); } - for(i = ret; i; i = alpm_list_next(i)) { + for(i = searchlist; i; i = alpm_list_next(i)) { char *group = NULL; alpm_list_t *grp; pmpkg_t *pkg = alpm_list_getdata(i); @@ -154,7 +154,7 @@ int pacman_query(alpm_list_t *targets) indentprint(alpm_pkg_get_desc(pkg), 4); printf("\n"); } - alpm_list_free(ret); + alpm_list_free(searchlist); return(0); } @@ -180,15 +180,8 @@ int pacman_query(alpm_list_t *targets) } } - for(i = targets; !done; i = (i ? alpm_list_next(i) : NULL)) { - if(targets == NULL) { - done = 1; - } else { - if(alpm_list_next(i) == NULL) { - done = 1; - } - package = alpm_list_getdata(i); - } + for(i = targets; i; i = alpm_list_next(i)) { + package = alpm_list_getdata(i); /* looking for groups */ if(config->group) { @@ -214,8 +207,7 @@ int pacman_query(alpm_list_t *targets) } } else { fprintf(stderr, _("error: group \"%s\" was not found\n"), package); - /* do not return on query operations - let's just carry on */ - /*return(2);*/ + ret++; } } continue; @@ -268,6 +260,7 @@ int pacman_query(alpm_list_t *targets) if(info == NULL) { /* something weird happened */ fprintf(stderr, _("error: package \"%s\" not found\n"), pkgname); + ret++; continue; } } @@ -301,6 +294,7 @@ int pacman_query(alpm_list_t *targets) info = alpm_db_get_pkg(db_local, package); if(info == NULL) { fprintf(stderr, _("error: package \"%s\" not found\n"), package); + ret++; continue; } @@ -327,7 +321,7 @@ int pacman_query(alpm_list_t *targets) } } - return(0); + return(ret); } /* vim: set ts=2 sw=2 noet: */ diff --git a/src/pacman/sync.c b/src/pacman/sync.c index 4f11bb4c..f013d45f 100644 --- a/src/pacman/sync.c +++ b/src/pacman/sync.c @@ -325,6 +325,7 @@ static int sync_group(int level, alpm_list_t *syncs, alpm_list_t *targets) static int sync_info(alpm_list_t *syncs, alpm_list_t *targets) { alpm_list_t *i, *j, *k; + int ret = 0; if(targets) { for(i = targets; i; i = alpm_list_next(i)) { @@ -367,6 +368,7 @@ static int sync_info(alpm_list_t *syncs, alpm_list_t *targets) if(!foundpkg) { fprintf(stderr, _("error: package '%s' was not found in repository '%s'\n"), pkgstr, repo); + ret++; } } else { pkgstr = target; @@ -387,6 +389,7 @@ static int sync_info(alpm_list_t *syncs, alpm_list_t *targets) } if(!foundpkg) { fprintf(stderr, _("error: package '%s' was not found\n"), pkgstr); + ret++; } } } @@ -401,7 +404,7 @@ static int sync_info(alpm_list_t *syncs, alpm_list_t *targets) } } - return(0); + return(ret); } static int sync_list(alpm_list_t *syncs, alpm_list_t *targets) |