2 const char *__progname;
4 #include <rpm/rpmbuild.h>
13 static int print_provides;
15 static int print_requires;
17 static void rpmdsPrint(const char * msg, rpmds ds, FILE * fp)
19 if (fp == NULL) fp = stderr;
22 fprintf(fp, "===================================== %s\n", msg);
25 while (rpmdsNext(ds) >= 0)
26 fprintf(fp, "%s\n", rpmdsDNEVR(ds)+2);
29 static struct poptOption optionsTable[] = {
31 { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmcliAllPoptTable, 0,
32 N_("Common options for all rpm modes and executables:"),
35 { "provides", 'P', POPT_ARG_VAL, &print_provides, -1,
37 { "requires", 'R', POPT_ARG_VAL, &print_requires, -1,
46 main(int argc, char *argv[])
56 if ((progname = strrchr(argv[0], '/')) != NULL)
61 optCon = rpmcliInit(argc, argv, optionsTable);
65 av = poptGetArgs(optCon);
71 while ((b = fgets(buf, sizeof(buf), stdin)) != NULL) {
72 buf[sizeof(buf)-1] = '\0';
73 be = b + strlen(buf) - 1;
74 while (strchr("\r\n", *be) != NULL)
81 /* Make sure file names are sorted. */
82 xx = argvSort(av, NULL);
84 /* Build file class dictionary. */
86 xx = rpmfcClassify(fc, av, NULL);
88 /* Build file/package dependency dictionary. */
92 rpmfcPrint(buf, fc, NULL);
96 rpmdsPrint(NULL, rpmfcProvides(fc), stdout);
98 rpmdsPrint(NULL, rpmfcRequires(fc), stdout);
105 optCon = rpmcliFini(optCon);