14 static int print_provides;
17 static int print_requires;
19 static void rpmdsPrint(const char * msg, rpmds ds, FILE * fp)
21 if (fp == NULL) fp = stderr;
24 fprintf(fp, "===================================== %s\n", msg);
27 while (rpmdsNext(ds) >= 0)
28 fprintf(fp, "%s\n", rpmdsDNEVR(ds)+2);
31 static struct poptOption optionsTable[] = {
33 { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmcliAllPoptTable, 0,
34 N_("Common options for all rpm modes and executables:"),
37 { "provides", 'P', POPT_ARG_VAL, &print_provides, -1,
39 { "requires", 'R', POPT_ARG_VAL, &print_requires, -1,
48 main(int argc, char *const argv[])
59 if ((progname = strrchr(argv[0], '/')) != NULL)
65 optCon = rpmcliInit(argc, argv, optionsTable);
69 av = poptGetArgs(optCon);
75 while ((b = fgets(buf, sizeof(buf), stdin)) != NULL) {
76 buf[sizeof(buf)-1] = '\0';
77 be = b + strlen(buf) - 1;
78 while (strchr("\r\n", *be) != NULL)
85 /* Make sure file names are sorted. */
86 xx = argvSort(av, NULL);
88 /* Build file class dictionary. */
90 xx = rpmfcClassify(fc, av);
92 /* Build file/package dependency dictionary. */
96 sprintf(buf, "final: files %d cdict[%d] %d%% ddictx[%d]", fc->nfiles, argvCount(fc->cdict), ((100 * fc->fknown)/fc->nfiles), argiCount(fc->ddictx));
97 rpmfcPrint(buf, fc, NULL);
101 rpmdsPrint(NULL, fc->provides, stdout);
103 rpmdsPrint(NULL, fc->requires, stdout);
110 optCon = rpmcliFini(optCon);