summaryrefslogtreecommitdiffstats
path: root/src/query
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 18:40:37 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 18:40:37 +0000
commitcabd780cae125bed23f70d57db05ae0f32d8df4c (patch)
treeaa0333438759b0295022ef95bd38df6b7226a89c /src/query
parentReleasing progress-linux version 1.22.4-0.0~progress7.99u1. (diff)
downloaddpkg-cabd780cae125bed23f70d57db05ae0f32d8df4c.tar.xz
dpkg-cabd780cae125bed23f70d57db05ae0f32d8df4c.zip
Merging upstream version 1.22.5.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/query')
-rw-r--r--src/query/main.c53
1 files changed, 26 insertions, 27 deletions
diff --git a/src/query/main.c b/src/query/main.c
index 7f8de59..6674896 100644
--- a/src/query/main.c
+++ b/src/query/main.c
@@ -69,7 +69,7 @@ pkg_array_match_patterns(struct pkg_array *array,
const char *const *argv)
{
int argc, i, ip, *found;
- int rc = 0;
+ int misses = 0;
struct pkg_spec *ps;
for (argc = 0; argv[argc]; argc++);
@@ -101,7 +101,7 @@ pkg_array_match_patterns(struct pkg_array *array,
for (ip = 0; ip < argc; ip++) {
if (!found[ip]) {
notice(_("no packages found matching %s"), argv[ip]);
- rc++;
+ misses++;
}
pkg_spec_destroy(&ps[ip]);
}
@@ -109,7 +109,7 @@ pkg_array_match_patterns(struct pkg_array *array,
free(ps);
free(found);
- return rc;
+ return misses;
}
struct list_format {
@@ -250,7 +250,7 @@ static int
listpackages(const char *const *argv)
{
struct pkg_array array;
- int rc = 0;
+ int misses = 0;
struct list_format fmt;
struct pager *pager;
@@ -279,7 +279,7 @@ listpackages(const char *const *argv)
pkg_array_foreach(&array, pkg_array_list_item, &fmt);
} else {
- rc = pkg_array_match_patterns(&array, pkg_array_list_item, &fmt, argv);
+ misses = pkg_array_match_patterns(&array, pkg_array_list_item, &fmt, argv);
}
m_output(stdout, _("<standard output>"));
@@ -290,7 +290,7 @@ listpackages(const char *const *argv)
pkg_array_destroy(&array);
modstatdb_shutdown();
- return rc;
+ return !!misses;
}
static int
@@ -335,7 +335,7 @@ static int
searchfiles(const char *const *argv)
{
const char *thisarg;
- int failures = 0;
+ int misses = 0;
struct varbuf path = VARBUF_INIT;
static struct varbuf vb;
@@ -378,7 +378,7 @@ searchfiles(const char *const *argv)
}
if (!found) {
notice(_("no path found matching pattern %s"), thisarg);
- failures++;
+ misses++;
m_output(stderr, _("<standard error>"));
} else {
m_output(stdout, _("<standard output>"));
@@ -388,13 +388,13 @@ searchfiles(const char *const *argv)
varbuf_destroy(&path);
- return failures;
+ return !!misses;
}
static int
print_status(const char *const *argv)
{
- int failures = 0;
+ int misses = 0;
modstatdb_open(msdbrw_readonly);
@@ -416,7 +416,7 @@ print_status(const char *const *argv)
!pkg_is_informative(pkg, &pkg->installed)) {
notice(_("package '%s' is not installed and no information is available"),
pkg_name(pkg, pnaw_nonambig));
- failures++;
+ misses++;
} else {
write_stanza(stdout, _("<standard output>"), pkg, &pkg->installed);
}
@@ -427,7 +427,7 @@ print_status(const char *const *argv)
}
m_output(stdout, _("<standard output>"));
- if (failures) {
+ if (misses) {
fputs(_("Use dpkg --info (= dpkg-deb --info) to examine archive files.\n"),
stderr);
m_output(stderr, _("<standard error>"));
@@ -435,13 +435,13 @@ print_status(const char *const *argv)
modstatdb_shutdown();
- return failures;
+ return !!misses;
}
static int
print_avail(const char *const *argv)
{
- int failures = 0;
+ int misses = 0;
modstatdb_open(msdbrw_readonly | msdbrw_available_readonly);
@@ -458,7 +458,7 @@ print_avail(const char *const *argv)
if (!pkg_is_informative(pkg, &pkg->available)) {
notice(_("package '%s' is not available"),
pkgbin_name(pkg, &pkg->available, pnaw_nonambig));
- failures++;
+ misses++;
} else {
write_stanza(stdout, _("<standard output>"), pkg, &pkg->available);
}
@@ -469,12 +469,12 @@ print_avail(const char *const *argv)
}
m_output(stdout, _("<standard output>"));
- if (failures)
+ if (misses)
m_output(stderr, _("<standard error>"));
modstatdb_shutdown();
- return failures;
+ return !!misses;
}
static int
@@ -484,7 +484,7 @@ list_files(const char *const *argv)
struct fsys_namenode_list *file;
struct pkginfo *pkg;
struct fsys_namenode *namenode;
- int failures = 0;
+ int misses = 0;
if (!*argv)
badusage(_("--%s needs at least one package name argument"), cipaction->olong);
@@ -498,7 +498,7 @@ list_files(const char *const *argv)
case PKG_STAT_NOTINSTALLED:
notice(_("package '%s' is not installed"),
pkg_name(pkg, pnaw_nonambig));
- failures++;
+ misses++;
break;
default:
ensure_packagefiles_available(pkg);
@@ -534,7 +534,7 @@ list_files(const char *const *argv)
}
m_output(stdout, _("<standard output>"));
- if (failures) {
+ if (misses) {
fputs(_("Use dpkg --contents (= dpkg-deb --contents) to list archive files contents.\n"),
stderr);
m_output(stderr, _("<standard error>"));
@@ -542,7 +542,7 @@ list_files(const char *const *argv)
modstatdb_shutdown();
- return failures;
+ return !!misses;
}
static void
@@ -566,14 +566,13 @@ showpackages(const char *const *argv)
struct pkg_array array;
struct pkg_format_node *fmt;
bool fmt_needs_db_fsys;
- int rc = 0;
+ int misses = 0;
fmt = pkg_format_parse(opt_showformat, &err);
if (!fmt) {
notice(_("error in show format: %s"), err.str);
dpkg_error_destroy(&err);
- rc++;
- return rc;
+ return 2;
}
fmt_needs_db_fsys = pkg_format_needs_db_fsys(fmt);
@@ -602,7 +601,7 @@ showpackages(const char *const *argv)
} else {
if (fmt_needs_db_fsys)
pkg_array_foreach(&array, pkg_array_load_db_fsys, NULL);
- rc = pkg_array_match_patterns(&array, pkg_array_show_item, fmt, argv);
+ misses = pkg_array_match_patterns(&array, pkg_array_show_item, fmt, argv);
}
m_output(stdout, _("<standard output>"));
@@ -612,7 +611,7 @@ showpackages(const char *const *argv)
pkg_format_free(fmt);
modstatdb_shutdown();
- return rc;
+ return !!misses;
}
static bool
@@ -883,5 +882,5 @@ int main(int argc, const char *const *argv) {
dpkg_program_done();
dpkg_locales_done();
- return !!ret;
+ return ret;
}