1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-02 22:46:30 +02:00

gpgtar: Make --files-from and --null work as described.

* tools/gpgtar-create.c (gpgtar_create): Add args files_from and
null_names.  Improve reading from a file.
* tools/gpgtar.c: Make global vars static.
(main): Remove tests for --files-from and --null option combinations.
Pass option variables to gpgtar_create.
--

GnuPG-bug-id: 5027
Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2020-08-20 15:50:50 +02:00
parent 32aac55875
commit e276f63e4a
No known key found for this signature in database
GPG key ID: E3FDFF218E45B72B
6 changed files with 100 additions and 27 deletions

View file

@ -140,10 +140,10 @@ static gpgrt_opt_t tar_opts[] = {
/* Global flags. */
enum cmd_and_opt_values cmd = 0;
int skip_crypto = 0;
const char *files_from = NULL;
int null_names = 0;
static enum cmd_and_opt_values cmd = 0;
static int skip_crypto = 0;
static const char *files_from = NULL;
static int null_names = 0;
@ -440,11 +440,6 @@ main (int argc, char **argv)
parse_arguments (&pargs, opts);
gpgrt_argparse (NULL, &pargs, NULL);
if ((files_from && !null_names) || (!files_from && null_names))
log_error ("--files-from and --null may only be used in conjunction\n");
if (files_from && strcmp (files_from, "-"))
log_error ("--files-from only supports argument \"-\"\n");
if (log_get_errorcount (0))
exit (2);
@ -482,12 +477,14 @@ main (int argc, char **argv)
case aEncrypt:
case aSign:
case aSignEncrypt:
if ((!argc && !null_names)
|| (argc && null_names))
if ((!argc && !files_from)
|| (argc && files_from))
gpgrt_usage (1);
if (opt.filename)
log_info ("note: ignoring option --set-filename\n");
err = gpgtar_create (null_names? NULL :argv,
err = gpgtar_create (files_from? NULL : argv,
files_from,
null_names,
!skip_crypto
&& (cmd == aEncrypt || cmd == aSignEncrypt),
cmd == aSign || cmd == aSignEncrypt);