From a982d562a19e1bf9d421cc64127635e403dd3f39 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Sun, 26 Mar 2000 17:24:04 +0000 Subject: no_comment --- autoirpm.update-all.cc | 44 ++++++++++++++++++++++++++++++-------------- 1 file changed, 30 insertions(+), 14 deletions(-) (limited to 'autoirpm.update-all.cc') diff --git a/autoirpm.update-all.cc b/autoirpm.update-all.cc index 90b524e0..de96edd4 100644 --- a/autoirpm.update-all.cc +++ b/autoirpm.update-all.cc @@ -44,26 +44,42 @@ int main(int argc, char **argv) { while ((header=headerRead(fd, HEADER_MAGIC_YES))) { int_32 type, count; unsigned short *p; - char **f, *name, *s; + char **f, *name; int printed = 0; - headerGetEntry(header, RPMTAG_NAME, &type, (void **) &name, &count); + headerGetEntry(header, RPMTAG_NAME, &type, (void **) &name, NULL); headerGetEntry(header, RPMTAG_FILEMODES, &type, (void **) &p, &count); - headerGetEntry(header, RPMTAG_OLDFILENAMES, &type, (void **) &f, &count); - for (; count--; *p++, *f++) - if ((*p & 040111) == 0111 && - (s = strrchr(*f, '/')) && - s - 3 >= *f && - strncmp(s - 3, "bin", 3) == 0 && - (!allow || allow->count(s + 1)) && - (!deny || !deny->count(s + 1))) { + headerGetEntry(header, RPMTAG_OLDFILENAMES, &type, (void **) &f, NULL); - if (!printed) { - printed = 1; - cout << name; + char ** baseNames, ** dirNames; + int_32 * dirIndexes; + headerGetEntry(header, RPMTAG_BASENAMES, &type, (void **) &baseNames, NULL); + headerGetEntry(header, RPMTAG_DIRINDEXES, &type, (void **) &dirIndexes, NULL); + headerGetEntry(header, RPMTAG_DIRNAMES, &type, (void **) &dirNames, NULL); + + for (int i = 0; i < count; i++) { + if ((p[i] & 040111) == 0111) { + int ok; + if (f) { + char *s = strrchr(f[i], '/'); + ok = s && s - 3 >= f[i] && strncmp(s - 3, "bin", 3) == 0 && + (!allow || allow->count(s + 1)) && + (!deny || !deny->count(s + 1)); + } else { + char *d = dirNames[dirIndexes[i]]; + ok = strlen(d) >= 4 && strncmp(d + strlen(d) - 4, "bin/", 4) == 0 && + (!allow || allow->count(baseNames[i])) && + (!deny || !deny->count(baseNames[i])); + } + if (ok) { + if (!printed) { + printed = 1; + cout << name; + } + if (f) cout << " " << f[i]; else cout << " " << dirNames[dirIndexes[i]] << baseNames[i]; } - cout << " " << *f; } + } if (printed) cout << "\n"; } fdClose(fd); -- cgit v1.2.1