Re: RPM C API (and other fun acronyms)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thursday, 28 September 2006, at 16:49:17 (-0500),
R. Tyler Ballance wrote:

> So I'm wondering, do I just not use rpmdbInitIterator() (since I've
> got to set the key string there) and will rpmdbSetIteratorRE()
> create the proper iterator for dumping all the packages on the
> machine?

To find matches to the name, something like this:

    dbmi = rpmdbInitIterator(dbh, RPMTAG_NAME, NULL, 0);
    if (dbmi) {
        rpmdbSetIteratorRE(dbmi, RPMTAG_NAME, RPMMIRE_DEFAULT, match_string);
    }
    if (! dbmi) {
        printf("No matches found in local RPM DB.\n");
    } else {
        while ((hdr = rpmdbNextIterator(dbmi))) {
            ...
        }
    }

"dbh" is the rpmdb handle, and match_string is the regex/wildcard/etc.
The rest is fairly obvious.

Michael

-- 
Michael Jennings (a.k.a. KainX)  http://www.kainx.org/  <mej@xxxxxxxxx>
n + 1, Inc., http://www.nplus1.net/       Author, Eterm (www.eterm.org)
-----------------------------------------------------------------------
 "Somebody love me; come and carry me away.  
  Somebody need me to be the blue in their grey."  -- Michael W. Smith

_______________________________________________
Rpm-list mailing list
Rpm-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/rpm-list

[Index of Archives]     [RPM Ecosystem]     [Linux Kernel]     [Red Hat Install]     [PAM]     [Red Hat Watch]     [Red Hat Development]     [Red Hat]     [Gimp]     [Yosemite News]     [IETF Discussion]

  Powered by Linux