+#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
int isSource;
rpmdb db;
dbIndexSet matches;
+ int recNumber;
if (source != QUERY_SRPM && source != QUERY_RPM) {
if (rpmdbOpen(prefix, &db, O_RDONLY, 0644)) {
case QUERY_SPACKAGE:
case QUERY_PACKAGE:
- rc = findPackageByLabel(db, arg, &matches);
- if (rc == 1)
- fprintf(stderr, "package %s is not installed\n", arg);
- else if (rc == 2) {
- fprintf(stderr, "error looking for package %s\n", arg);
+ if (isdigit(arg[0])) {
+ recNumber = atoi(arg);
+ message(MESS_DEBUG, "showing package: %d\n", recNumber);
+ h = rpmdbGetRecord(db, recNumber);
+
+ if (!h)
+ fprintf(stderr, "record %d could not be read\n", recNumber);
+ else {
+ printHeader(h, queryFlags);
+ freeHeader(h);
+ }
} else {
- showMatches(db, matches, queryFlags);
- freeDBIndexRecord(matches);
+ rc = findPackageByLabel(db, arg, &matches);
+ if (rc == 1)
+ fprintf(stderr, "package %s is not installed\n", arg);
+ else if (rc == 2) {
+ fprintf(stderr, "error looking for package %s\n", arg);
+ } else {
+ showMatches(db, matches, queryFlags);
+ freeDBIndexRecord(matches);
+ }
}
break;
}