24 #define _RPMGI_INTERNAL
80 static int cmpItem(
const void * a,
const void * b) {
89 for (i = 0; i <
nitems; i++)
100 if (fp == NULL) fp = stdout;
101 for (i = 0; i <
nitems; i++) {
110 fprintf(fp,
"%s\n", ip->
path);
117 HE_t he = memset(
alloca(
sizeof(*he)), 0,
sizeof(*he));
131 for (i = 0; i <
nitems; i++) {
144 if (!xx || md5 == NULL) {
211 struct stat sb, * st;
222 if (items != NULL &&
nitems > 0) {
223 Item needle = memset(
alloca(
sizeof(*needle)), 0,
sizeof(*needle));
224 Item * found, * fneedle = &needle;
228 found = bsearch(fneedle, items,
nitems,
sizeof(*found),
cmpItem);
231 while (found > items &&
cmpItem(found-1, fneedle) == 0)
236 while (found < (items +
nitems) &&
cmpItem(found, fneedle) == 0) {
255 }
else if (ec == 1) {
265 if (st == NULL || ((
long)st & 0xffff0000) == 0
L) {
267 memset(st, 0,
sizeof(*st));
272 items[i]->
size = st->st_size;
273 items[i]->
mtime = st->st_mtime;
283 fprintf(stderr,
"\t%*s [%d] %s\n",
313 if (!(fts_info >= 1 && fts_info <= 14))
320 FTS * ftsp = gi->ftsp;
324 const char * pattern;
356 if ((patterns = bhg->
patterns) != NULL)
357 while ((pattern = *patterns++) != NULL) {
371 if ((patterns = bhg->
patterns) != NULL)
372 while ((pattern = *patterns++) != NULL) {
409 if (strcmp(s,
".rpm"))
451 if (argv != NULL && * argv != NULL) {
459 while ((arg = *argv++) != NULL) {
463 t[-1] = (char)(single ?
'\0' :
')');
476 const char * pattern;
481 macro =
"%{_bhpath}";
484 macro =
"%{_bhcoll}";
487 macro = (buf[0] ==
'\0' ?
"%{_bhN}" : buf);
503 if (pattern == NULL || *pattern ==
'\0') {
504 pattern =
_free(pattern);
509 if (bhglobs[i].patterns[0] != NULL)
511 i, bhglobs[i].patterns[0]);
522 bhglobs =
_free(bhglobs);
531 N_(
"don't verify header+payload signature"), NULL },
533 {
"cache",
'\0', POPT_ARG_VAL, &
noCache, 0,
534 N_(
"update cache database"), NULL },
535 {
"nocache",
'\0', POPT_ARG_VAL, &
noCache, -1,
536 N_(
"don't update cache database, only print package paths"), NULL },
539 N_(
"File tree walk options:"),
543 N_(
"Common options for all rpm modes and executables:"),
566 s =
rpmExpand(
"%{?_cache_dbpath}", NULL);
575 fprintf(stderr,
_(
"%s: %%{_cache_dbpath} macro is mis-configured.\n"),
590 { uint32_t tid = (uint32_t) time(NULL);
618 fprintf(stderr,
_(
"%s: cache operation failed: ec %d.\n"),