diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2022-04-01 11:35:31 +0300 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2022-04-04 10:04:25 +0300 |
commit | 1ad4884c9ed0e58810b07016b138f7252f81ae3c (patch) | |
tree | 37b99a3932a7b4cc4731dcf54df61d5e77f75a3c /tools/rpmuncompress.c | |
parent | d2156a90519ca3e604f235e2dbdf5a30f96f7ba6 (diff) | |
download | rpm-1ad4884c9ed0e58810b07016b138f7252f81ae3c.tar.gz |
Add dry-run option to rpmuncompress to make testing nicer
Diffstat (limited to 'tools/rpmuncompress.c')
-rw-r--r-- | tools/rpmuncompress.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/tools/rpmuncompress.c b/tools/rpmuncompress.c index 950f23470..2cac40d36 100644 --- a/tools/rpmuncompress.c +++ b/tools/rpmuncompress.c @@ -12,12 +12,15 @@ static int verbose = 0; static int extract = 0; +static int dryrun = 0; static struct poptOption optionsTable[] = { { "extract", 'x', POPT_ARG_VAL, &extract, 1, N_("extract an archive"), NULL }, { "verbose", 'v', POPT_ARG_VAL, &verbose, 1, N_("provide more detailed output"), NULL }, + { "dry-run", 'n', POPT_ARG_VAL, &dryrun, 1, + N_("only print what would be done"), NULL }, POPT_AUTOALIAS POPT_AUTOHELP @@ -135,9 +138,14 @@ int main(int argc, char *argv[]) if (cmd) { FILE *inp = NULL; - if (verbose) + if (verbose || dryrun) fprintf(stderr, "%s\n", cmd); + if (dryrun) { + ec = EXIT_SUCCESS; + goto exit; + } + inp = popen(cmd, "r"); if (inp) { int status, c; |