diff options
author | jbj <devnull@localhost> | 1999-07-13 23:33:02 +0000 |
---|---|---|
committer | jbj <devnull@localhost> | 1999-07-13 23:33:02 +0000 |
commit | 4bd2f3531a51fd99adb4e3e7007a3ffee1b178ef (patch) | |
tree | ee451ca89af0649686aca0d9bd5e30028c9682e6 /lib/lookup.c | |
parent | fca8845a9a45f9d2d8940f145b311ef79d51c1ee (diff) | |
download | librpm-tizen-4bd2f3531a51fd99adb4e3e7007a3ffee1b178ef.tar.gz librpm-tizen-4bd2f3531a51fd99adb4e3e7007a3ffee1b178ef.tar.bz2 librpm-tizen-4bd2f3531a51fd99adb4e3e7007a3ffee1b178ef.zip |
File internals rearranged to taste.
CVS patchset: 3152
CVS date: 1999/07/13 23:33:02
Diffstat (limited to 'lib/lookup.c')
-rw-r--r-- | lib/lookup.c | 100 |
1 files changed, 51 insertions, 49 deletions
diff --git a/lib/lookup.c b/lib/lookup.c index cab17bb13..d9db80ad7 100644 --- a/lib/lookup.c +++ b/lib/lookup.c @@ -3,55 +3,7 @@ #include <rpmlib.h> #include "lookup.h" -/* 0 found matches */ -/* 1 no matches */ -/* 2 error */ -int rpmdbFindByHeader(rpmdb db, Header h, dbiIndexSet * matches) { - char * name, * version, * release; - - headerGetEntry(h, RPMTAG_NAME, NULL, (void **) &name, NULL); - headerGetEntry(h, RPMTAG_VERSION, NULL, (void **) &version, NULL); - headerGetEntry(h, RPMTAG_RELEASE, NULL, (void **) &release, NULL); - - return findMatches(db, name, version, release, matches); -} - -/* 0 found matches */ -/* 1 no matches */ -/* 2 error */ -int rpmdbFindByLabel(rpmdb db, const char * arg, dbiIndexSet * matches) { - char * localarg, * chptr; - char * release; - int rc; - - if (!strlen(arg)) return 1; - - /* did they give us just a name? */ - rc = findMatches(db, arg, NULL, NULL, matches); - if (rc != 1) return rc; - - /* maybe a name and a release */ - localarg = alloca(strlen(arg) + 1); - strcpy(localarg, arg); - - chptr = (localarg + strlen(localarg)) - 1; - while (chptr > localarg && *chptr != '-') chptr--; - if (chptr == localarg) return 1; - - *chptr = '\0'; - rc = findMatches(db, localarg, chptr + 1, NULL, matches); - if (rc != 1) return rc; - - /* how about name-version-release? */ - - release = chptr + 1; - while (chptr > localarg && *chptr != '-') chptr--; - if (chptr == localarg) return 1; - - *chptr = '\0'; - return findMatches(db, localarg, chptr + 1, release, matches); -} - +/* XXX used in transaction.c */ /* 0 found matches */ /* 1 no matches */ /* 2 error */ @@ -113,3 +65,53 @@ int findMatches(rpmdb db, const char * name, const char * version, return 0; } +/* 0 found matches */ +/* 1 no matches */ +/* 2 error */ +int rpmdbFindByHeader(rpmdb db, Header h, dbiIndexSet * matches) +{ + char * name, * version, * release; + + headerGetEntry(h, RPMTAG_NAME, NULL, (void **) &name, NULL); + headerGetEntry(h, RPMTAG_VERSION, NULL, (void **) &version, NULL); + headerGetEntry(h, RPMTAG_RELEASE, NULL, (void **) &release, NULL); + + return findMatches(db, name, version, release, matches); +} + +/* 0 found matches */ +/* 1 no matches */ +/* 2 error */ +int rpmdbFindByLabel(rpmdb db, const char * arg, dbiIndexSet * matches) +{ + char * localarg, * chptr; + char * release; + int rc; + + if (!strlen(arg)) return 1; + + /* did they give us just a name? */ + rc = findMatches(db, arg, NULL, NULL, matches); + if (rc != 1) return rc; + + /* maybe a name and a release */ + localarg = alloca(strlen(arg) + 1); + strcpy(localarg, arg); + + chptr = (localarg + strlen(localarg)) - 1; + while (chptr > localarg && *chptr != '-') chptr--; + if (chptr == localarg) return 1; + + *chptr = '\0'; + rc = findMatches(db, localarg, chptr + 1, NULL, matches); + if (rc != 1) return rc; + + /* how about name-version-release? */ + + release = chptr + 1; + while (chptr > localarg && *chptr != '-') chptr--; + if (chptr == localarg) return 1; + + *chptr = '\0'; + return findMatches(db, localarg, chptr + 1, release, matches); +} |