#include #include ///extern int _rpmio_debug = 1; int main(int argc, const char *argv[]) { const char *progname = argv[0]; if (argc != 3) { fprintf(stderr, "Usage: %s QUERY pkglist", progname); exit(2); } const char *query = argv[1], *pkglist = argv[2]; FD_t Fd = Fopen(pkglist, "r"); if (Ferror(Fd)) { fprintf(stderr, "%s: %s: %s\n", progname, pkglist, Fstrerror(Fd)); exit(1); } Header h; while ((h = headerRead(Fd, HEADER_MAGIC_YES))) { char *str = headerSprintf(h, query, rpmTagTable, rpmHeaderFormats, NULL); if (str) { fputs(str, stdout); str = _free(str); } headerFree(h); } Fclose(Fd); return 0; } /* ex:set ts=8 sts=4 sw=4 noet: */