aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2013-09-29 22:19:39 +0000
committerMike Frysinger <vapier@gentoo.org>2013-09-29 22:19:39 +0000
commit66abc9176f7916222cfb694ba04abd43c3690d27 (patch)
tree33a9cd662e6b2d285dff7f6d848522bda656d360 /qdepends.c
parentadd more todo stuff (diff)
downloadportage-utils-66abc9176f7916222cfb694ba04abd43c3690d27.tar.gz
portage-utils-66abc9176f7916222cfb694ba04abd43c3690d27.tar.bz2
portage-utils-66abc9176f7916222cfb694ba04abd43c3690d27.zip
qdepends: warn if no matches were found #459970
Diffstat (limited to 'qdepends.c')
-rw-r--r--qdepends.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/qdepends.c b/qdepends.c
index a7bb8d5..dad3f02 100644
--- a/qdepends.c
+++ b/qdepends.c
@@ -1,7 +1,7 @@
/*
* Copyright 2005-2013 Gentoo Foundation
* Distributed under the terms of the GNU General Public License v2
- * $Header: /var/cvsroot/gentoo-projects/portage-utils/qdepends.c,v 1.65 2013/09/29 10:36:08 vapier Exp $
+ * $Header: /var/cvsroot/gentoo-projects/portage-utils/qdepends.c,v 1.66 2013/09/29 22:19:39 vapier Exp $
*
* Copyright 2005-2010 Ned Ludd - <solar@gentoo.org>
* Copyright 2005-2013 Mike Frysinger - <vapier@gentoo.org>
@@ -32,7 +32,7 @@ static const char * const qdepends_opts_help[] = {
"Pretty format specified depend strings",
COMMON_OPTS_HELP
};
-static const char qdepends_rcsid[] = "$Id: qdepends.c,v 1.65 2013/09/29 10:36:08 vapier Exp $";
+static const char qdepends_rcsid[] = "$Id: qdepends.c,v 1.66 2013/09/29 22:19:39 vapier Exp $";
#define qdepends_usage(ret) usage(ret, QDEPENDS_FLAGS, qdepends_long_opts, qdepends_opts_help, lookup_applet_idx("qdepends"))
static char qdep_name_only = 0;
@@ -465,7 +465,7 @@ _q_static int qdepends_main_vdb_cb(q_vdb_pkg_ctx *pkg_ctx, void *priv)
dep_burn_tree(dep_tree);
- return EXIT_SUCCESS;
+ return 1;
}
_q_static int qdepends_vdb_deep_cb(q_vdb_pkg_ctx *pkg_ctx, void *priv)
@@ -523,7 +523,7 @@ _q_static int qdepends_vdb_deep_cb(q_vdb_pkg_ctx *pkg_ctx, void *priv)
}
dep_burn_tree(dep_tree);
- return EXIT_SUCCESS;
+ return 1;
}
int qdepends_main(int argc, char **argv)
@@ -533,7 +533,7 @@ int qdepends_main(int argc, char **argv)
.argv = argv,
};
q_vdb_pkg_cb *cb;
- int i;
+ int i, ret;
bool do_format = false;
const char *query = NULL;
const char *depend_file;
@@ -576,16 +576,18 @@ int qdepends_main(int argc, char **argv)
cb = query ? qdepends_vdb_deep_cb : qdepends_main_vdb_cb;
if (!depend_file) {
- int ret = 0;
+ ret = 0;
for (i = 0; depend_files[i]; ++i) {
printf(" %s*%s %s\n", GREEN, NORM, depend_files[i]);
state.depend_file = depend_files[i];
- ret += q_vdb_foreach_pkg(cb, &state, NULL);
+ ret |= q_vdb_foreach_pkg(cb, &state, NULL);
}
- return ret;
- }
+ } else
+ ret = q_vdb_foreach_pkg(cb, &state, NULL);
- return q_vdb_foreach_pkg(cb, &state, NULL);
+ if (!ret && !quiet)
+ warn("no matches found for your query");
+ return ret ? EXIT_SUCCESS : EXIT_FAILURE;
}
#else