diff options
author | jbj <devnull@localhost> | 2004-10-14 15:45:41 +0000 |
---|---|---|
committer | jbj <devnull@localhost> | 2004-10-14 15:45:41 +0000 |
commit | d5bce7dc38c78eba9bf2f9e67554b1f1a3ca19eb (patch) | |
tree | a06ccf76e1955e856a6ad5940fdc241f315a11fd /lib/rpmgi.c | |
parent | 9e30825226d5b1613eb210094fde5f5488fb4725 (diff) | |
download | librpm-tizen-d5bce7dc38c78eba9bf2f9e67554b1f1a3ca19eb.tar.gz librpm-tizen-d5bce7dc38c78eba9bf2f9e67554b1f1a3ca19eb.tar.bz2 librpm-tizen-d5bce7dc38c78eba9bf2f9e67554b1f1a3ca19eb.zip |
Hack in hdlist queries.
CVS patchset: 7463
CVS date: 2004/10/14 15:45:41
Diffstat (limited to 'lib/rpmgi.c')
-rw-r--r-- | lib/rpmgi.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/lib/rpmgi.c b/lib/rpmgi.c index 65260bff1..7b880686b 100644 --- a/lib/rpmgi.c +++ b/lib/rpmgi.c @@ -14,6 +14,8 @@ /*@unchecked@*/ int _rpmgi_debug = 0; +static const char * hdlistpath = "/usr/share/comps/i386/hdlist"; + rpmgi XrpmgiUnlink(rpmgi gi, const char * msg, const char * fn, unsigned ln) { if (gi == NULL) return NULL; @@ -68,6 +70,10 @@ fprintf(stderr, "*** gi %p\t%p[%d]\n", gi, gi->argv, gi->argc); gi->ftsp = NULL; gi->fts = NULL; } + if (gi->fd != NULL) { + (void) Fclose(gi->fd); + gi->fd = NULL; + } gi->mi = rpmdbFreeIterator(gi->mi); gi->ts = rpmtsFree(gi->ts); @@ -97,6 +103,7 @@ fprintf(stderr, "*** gi %p\t%p\n", gi, gi->mi); break; case RPMGI_HDLIST: + gi->fd = Fopen(hdlistpath, "r.ufdio"); break; case RPMGI_ARGLIST: case RPMGI_FTSWALK: @@ -189,6 +196,14 @@ const char * rpmgiNext(/*@null@*/ rpmgi gi) } break; case RPMGI_HDLIST: + h = headerRead(gi->fd, HEADER_MAGIC_YES); + if (h != NULL) { + val = rpmgiPathOrQF(gi, "hdlist", &h); + } else { + (void) Fclose(gi->fd); + gi->fd = NULL; + gi->i = -1; + } break; case RPMGI_ARGLIST: if (gi->argv != NULL && gi->argv[gi->i] != NULL) { @@ -244,7 +259,7 @@ int rpmgiSetQueryFormat(rpmgi gi, const char * queryFormat) if (gi != NULL) { gi->queryFormat = _free(gi->queryFormat); - gi->queryFormat = xstrdup(queryFormat); + gi->queryFormat = (queryFormat != NULL ? xstrdup(queryFormat) : NULL); } return rc; |