3 #include <rpmio_internal.h>
4 #define _RPMGI_INTERNAL
9 #include <rpmmessages.h>
14 static int gitag = RPMGI_FTSWALK;
15 static int ftsOpts = 0;
17 static struct poptOption optionsTable[] = {
18 { "rpmgidebug", 'd', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_rpmgi_debug, -1,
19 N_("debug generalized iterator"), NULL},
21 { "rpmdb", '\0', POPT_ARG_VAL, &gitag, RPMGI_RPMDB,
22 N_("iterate rpmdb"), NULL },
23 { "hdlist", '\0', POPT_ARG_VAL, &gitag, RPMGI_HDLIST,
24 N_("iterate hdlist"), NULL },
25 { "arglist", '\0', POPT_ARG_VAL, &gitag, RPMGI_ARGLIST,
26 N_("iterate arglist"), NULL },
27 { "ftswalk", '\0', POPT_ARG_VAL, &gitag, RPMGI_FTSWALK,
28 N_("iterate fts(3) walk"), NULL },
30 { "comfollow", '\0', POPT_BIT_SET, &ftsOpts, FTS_COMFOLLOW,
31 N_("follow command line symlinks"), NULL },
32 { "logical", '\0', POPT_BIT_SET, &ftsOpts, FTS_LOGICAL,
33 N_("logical walk"), NULL },
34 { "nochdir", '\0', POPT_BIT_SET, &ftsOpts, FTS_NOCHDIR,
35 N_("don't change directories"), NULL },
36 { "nostat", '\0', POPT_BIT_SET, &ftsOpts, FTS_NOSTAT,
37 N_("don't get stat info"), NULL },
38 { "physical", '\0', POPT_BIT_SET, &ftsOpts, FTS_PHYSICAL,
39 N_("physical walk"), NULL },
40 { "seedot", '\0', POPT_BIT_SET, &ftsOpts, FTS_SEEDOT,
41 N_("return dot and dot-dot"), NULL },
42 { "xdev", '\0', POPT_BIT_SET, &ftsOpts, FTS_XDEV,
43 N_("don't cross devices"), NULL },
44 { "whiteout", '\0', POPT_BIT_SET, &ftsOpts, FTS_WHITEOUT,
45 N_("return whiteout information"), NULL },
48 { "ftpdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_ftp_debug, -1,
49 N_("debug protocol data stream"), NULL},
50 { "rpmiodebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_rpmio_debug, -1,
51 N_("debug rpmio I/O"), NULL},
52 { "urldebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_url_debug, -1,
53 N_("debug URL cache handling"), NULL},
54 { "verbose", 'v', 0, 0, 'v', NULL, NULL },
57 { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmcliAllPoptTable, 0,
58 N_("Common options for all rpm modes and executables:"),
67 main(int argc, char *const argv[])
77 optCon = rpmcliInit(argc, argv, optionsTable);
82 ftsOpts = (FTS_COMFOLLOW | FTS_LOGICAL | FTS_NOSTAT);
85 av = poptGetArgs(optCon);
86 gi = rpmgiNew(ts, gitag, av, ftsOpts);
89 while ((arg = rpmgiNext(gi)) != NULL) {
90 fprintf(stderr, "%5d %s\n", ac, arg);
97 optCon = rpmcliFini(optCon);