summaryrefslogtreecommitdiff
path: root/lib/query.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/query.c')
-rw-r--r--lib/query.c34
1 files changed, 16 insertions, 18 deletions
diff --git a/lib/query.c b/lib/query.c
index 3f1a8312f..1465cbe5d 100644
--- a/lib/query.c
+++ b/lib/query.c
@@ -146,7 +146,7 @@ static int queryHeader(FILE *fp, Header h, const char * chptr)
return 0;
}
-int showQueryPackage(QVA_t *qva, /*@unused@*/rpmdb db, Header h)
+int showQueryPackage(QVA_t *qva, /*@unused@*/rpmdb rpmdb, Header h)
{
FILE *fp = stdout; /* XXX FIXME: pass as arg */
int queryFlags = qva->qva_flags;
@@ -445,7 +445,7 @@ int (*parseSpecVec) (Spec *specp, const char *specFile, const char *rootdir,
void (*freeSpecVec) (Spec spec) = NULL;
int rpmQueryVerify(QVA_t *qva, enum rpmQVSources source, const char * arg,
- rpmdb db, QVF_t showPackage)
+ rpmdb rpmdb, QVF_t showPackage)
{
rpmdbMatchIterator mi = NULL;
Header h;
@@ -491,7 +491,7 @@ int rpmQueryVerify(QVA_t *qva, enum rpmQVSources source, const char * arg,
retcode = 1;
break;
}
- retcode = showPackage(qva, db, h);
+ retcode = showPackage(qva, rpmdb, h);
headerFree(h);
break;
case 1:
@@ -553,7 +553,7 @@ int rpmQueryVerify(QVA_t *qva, enum rpmQVSources source, const char * arg,
case RPMQV_ALL:
/* RPMDBI_PACKAGES */
- mi = rpmdbInitIterator(db, RPMDBI_PACKAGES, NULL, 0);
+ mi = rpmdbInitIterator(rpmdb, RPMDBI_PACKAGES, NULL, 0);
if (mi == NULL) {
fprintf(stderr, _("no packages\n"));
retcode = 1;
@@ -563,7 +563,7 @@ int rpmQueryVerify(QVA_t *qva, enum rpmQVSources source, const char * arg,
break;
case RPMQV_GROUP:
- mi = rpmdbInitIterator(db, RPMTAG_GROUP, arg, 0);
+ mi = rpmdbInitIterator(rpmdb, RPMTAG_GROUP, arg, 0);
if (mi == NULL) {
fprintf(stderr, _("group %s does not contain any packages\n"), arg);
retcode = 1;
@@ -573,7 +573,7 @@ int rpmQueryVerify(QVA_t *qva, enum rpmQVSources source, const char * arg,
break;
case RPMQV_TRIGGEREDBY:
- mi = rpmdbInitIterator(db, RPMTAG_TRIGGERNAME, arg, 0);
+ mi = rpmdbInitIterator(rpmdb, RPMTAG_TRIGGERNAME, arg, 0);
if (mi == NULL) {
fprintf(stderr, _("no package triggers %s\n"), arg);
retcode = 1;
@@ -583,7 +583,7 @@ int rpmQueryVerify(QVA_t *qva, enum rpmQVSources source, const char * arg,
break;
case RPMQV_WHATREQUIRES:
- mi = rpmdbInitIterator(db, RPMTAG_REQUIRENAME, arg, 0);
+ mi = rpmdbInitIterator(rpmdb, RPMTAG_REQUIRENAME, arg, 0);
if (mi == NULL) {
fprintf(stderr, _("no package requires %s\n"), arg);
retcode = 1;
@@ -594,7 +594,7 @@ int rpmQueryVerify(QVA_t *qva, enum rpmQVSources source, const char * arg,
case RPMQV_WHATPROVIDES:
if (arg[0] != '/') {
- mi = rpmdbInitIterator(db, RPMTAG_PROVIDENAME, arg, 0);
+ mi = rpmdbInitIterator(rpmdb, RPMTAG_PROVIDENAME, arg, 0);
if (mi == NULL) {
fprintf(stderr, _("no package provides %s\n"), arg);
retcode = 1;
@@ -605,7 +605,7 @@ int rpmQueryVerify(QVA_t *qva, enum rpmQVSources source, const char * arg,
}
/*@fallthrough@*/
case RPMQV_PATH:
- mi = rpmdbInitIterator(db, RPMTAG_BASENAMES, arg, 0);
+ mi = rpmdbInitIterator(rpmdb, RPMTAG_BASENAMES, arg, 0);
if (mi == NULL) {
int myerrno = 0;
if (access(arg, F_OK) != 0)
@@ -645,7 +645,7 @@ int rpmQueryVerify(QVA_t *qva, enum rpmQVSources source, const char * arg,
}
rpmMessage(RPMMESS_DEBUG, _("package record number: %u\n"), recOffset);
/* RPMDBI_PACKAGES */
- mi = rpmdbInitIterator(db, RPMDBI_PACKAGES, &recOffset, sizeof(recOffset));
+ mi = rpmdbInitIterator(rpmdb, RPMDBI_PACKAGES, &recOffset, sizeof(recOffset));
if (mi == NULL) {
fprintf(stderr, _("record %d could not be read\n"), recOffset);
retcode = 1;
@@ -656,7 +656,7 @@ int rpmQueryVerify(QVA_t *qva, enum rpmQVSources source, const char * arg,
case RPMQV_PACKAGE:
/* XXX HACK to get rpmdbFindByLabel out of the API */
- mi = rpmdbInitIterator(db, RPMDBI_LABEL, arg, 0);
+ mi = rpmdbInitIterator(rpmdb, RPMDBI_LABEL, arg, 0);
if (mi == NULL) {
fprintf(stderr, _("package %s is not installed\n"), arg);
retcode = 1;
@@ -671,7 +671,7 @@ int rpmQueryVerify(QVA_t *qva, enum rpmQVSources source, const char * arg,
int rpmQuery(QVA_t *qva, enum rpmQVSources source, const char * arg)
{
- rpmdb db = NULL;
+ rpmdb rpmdb = NULL;
int rc;
switch (source) {
@@ -679,17 +679,15 @@ int rpmQuery(QVA_t *qva, enum rpmQVSources source, const char * arg)
case RPMQV_SPECFILE:
break;
default:
- if (rpmdbOpen(qva->qva_prefix, &db, O_RDONLY, 0644)) {
- fprintf(stderr, _("rpmQuery: rpmdbOpen() failed\n"));
+ if (rpmdbOpen(qva->qva_prefix, &rpmdb, O_RDONLY, 0644))
return 1;
- }
break;
}
- rc = rpmQueryVerify(qva, source, arg, db, showQueryPackage);
+ rc = rpmQueryVerify(qva, source, arg, rpmdb, showQueryPackage);
- if (db)
- rpmdbClose(db);
+ if (rpmdb)
+ rpmdbClose(rpmdb);
return rc;
}