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

Re: RPM C API (and other fun acronyms)



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 kainx org>
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


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