commit: 64dbab476d3a9d287b4d114f66923f0872a08774
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sun Nov 17 11:51:58 2019 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sun Nov 17 11:51:58 2019 +0000
URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=64dbab47
qlist: fix -a option
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
qlist.c | 27 +++++++++++++--------------
1 file changed, 13 insertions(+), 14 deletions(-)
diff --git a/qlist.c b/qlist.c
index e0a8a07..a97111d 100644
--- a/qlist.c
+++ b/qlist.c
@@ -336,23 +336,22 @@ qlist_cb(tree_pkg_ctx *pkg_ctx, void *priv)
depend_atom *atom;
/* see if this cat/pkg is requested */
- for (i = optind; i < state->argc; ++i)
- if (qlist_match(pkg_ctx, state->argv[i],
- &state->atoms[i - optind],
state->exact))
- break;
- if ((i == state->argc) && (state->argc != optind))
- return 0;
+ if (!state->all) {
+ for (i = optind; i < state->argc; ++i)
+ if (qlist_match(pkg_ctx, state->argv[i],
+ &state->atoms[i - optind],
state->exact))
+ break;
+ if (i == state->argc)
+ return 0;
+ }
atom = tree_get_atom(pkg_ctx, state->need_full_atom);
if (state->just_pkgname) {
- if ((state->all + state->just_pkgname) < 2) {
- printf("%s%s\n",
- atom_format(state->fmt, atom),
- umapstr(state->show_umap, pkg_ctx));
- }
+ printf("%s%s\n",
+ atom_format(state->fmt, atom),
+ umapstr(state->show_umap, pkg_ctx));
- if (!state->all)
- return 1;
+ return 1;
}
if (verbose)
@@ -449,7 +448,7 @@ int qlist_main(int argc, char **argv)
/* default to showing syms and objs */
if (!state.show_dir && !state.show_obj && !state.show_sym)
state.show_obj = state.show_sym = true;
- if (argc == optind && !state.just_pkgname)
+ if (argc == optind && !state.all)
qlist_usage(EXIT_FAILURE);
if (state.fmt == NULL) {