Add dry-run option to rpmuncompress to make testing nicer

This commit is contained in:
Panu Matilainen 2022-04-01 11:35:31 +03:00
parent d2156a9051
commit 1ad4884c9e
1 changed files with 9 additions and 1 deletions

View File

@ -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;