mirror of
git://git.gnupg.org/gnupg.git
synced 2025-02-07 17:33:02 +01:00
gpgtar: Allow decryption from stdin.
* tools/gpgtar.c (main): Revamp switch and fix usage test for aDecrypt and aList. -- GnuPG-bug-id: 6355
This commit is contained in:
parent
92e4f856c5
commit
c66dacb98a
@ -1846,6 +1846,8 @@ Put given files and directories into a vanilla ``ustar'' archive.
|
|||||||
@item --extract
|
@item --extract
|
||||||
@opindex extract
|
@opindex extract
|
||||||
Extract all files from a vanilla ``ustar'' archive.
|
Extract all files from a vanilla ``ustar'' archive.
|
||||||
|
If no file name is given (or it is "-") the archive is taken from
|
||||||
|
stdin.
|
||||||
|
|
||||||
@item --encrypt
|
@item --encrypt
|
||||||
@itemx -e
|
@itemx -e
|
||||||
@ -1857,7 +1859,8 @@ be decrypted via a secret key or a passphrase.
|
|||||||
@item --decrypt
|
@item --decrypt
|
||||||
@itemx -d
|
@itemx -d
|
||||||
@opindex decrypt
|
@opindex decrypt
|
||||||
Extract all files from an encrypted archive.
|
Extract all files from an encrypted archive. If no file name is given
|
||||||
|
(or it is "-") the archive is taken from stdin.
|
||||||
|
|
||||||
@item --sign
|
@item --sign
|
||||||
@itemx -s
|
@itemx -s
|
||||||
@ -1868,7 +1871,8 @@ encrypted archive.
|
|||||||
@item --list-archive
|
@item --list-archive
|
||||||
@itemx -t
|
@itemx -t
|
||||||
@opindex list-archive
|
@opindex list-archive
|
||||||
List the contents of the specified archive.
|
List the contents of the specified archive. If no file name is given
|
||||||
|
(or it is "-") the archive is taken from stdin.
|
||||||
|
|
||||||
@item --symmetric
|
@item --symmetric
|
||||||
@itemx -c
|
@itemx -c
|
||||||
|
@ -493,17 +493,27 @@ main (int argc, char **argv)
|
|||||||
|
|
||||||
switch (cmd)
|
switch (cmd)
|
||||||
{
|
{
|
||||||
|
case aDecrypt:
|
||||||
case aList:
|
case aList:
|
||||||
if (argc > 1)
|
if (argc > 1)
|
||||||
usage (1);
|
usage (1);
|
||||||
fname = argc ? *argv : NULL;
|
fname = (argc && strcmp (*argv, "-"))? *argv : NULL;
|
||||||
if (opt.filename)
|
if (opt.filename)
|
||||||
log_info ("note: ignoring option --set-filename\n");
|
log_info ("note: ignoring option --set-filename\n");
|
||||||
if (files_from)
|
if (files_from)
|
||||||
log_info ("note: ignoring option --files-from\n");
|
log_info ("note: ignoring option --files-from\n");
|
||||||
err = gpgtar_list (fname, !skip_crypto);
|
if (cmd == aDecrypt)
|
||||||
if (err && log_get_errorcount (0) == 0)
|
{
|
||||||
log_error ("listing archive failed: %s\n", gpg_strerror (err));
|
err = gpgtar_extract (fname, !skip_crypto);
|
||||||
|
if (err && !log_get_errorcount (0))
|
||||||
|
log_error ("extracting archive failed: %s\n", gpg_strerror (err));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
err = gpgtar_list (fname, !skip_crypto);
|
||||||
|
if (err && !log_get_errorcount (0))
|
||||||
|
log_error ("listing archive failed: %s\n", gpg_strerror (err));
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case aEncrypt:
|
case aEncrypt:
|
||||||
@ -524,19 +534,6 @@ main (int argc, char **argv)
|
|||||||
log_error ("creating archive failed: %s\n", gpg_strerror (err));
|
log_error ("creating archive failed: %s\n", gpg_strerror (err));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case aDecrypt:
|
|
||||||
if (argc != 1)
|
|
||||||
usage (1);
|
|
||||||
if (opt.outfile)
|
|
||||||
log_info ("note: ignoring option --output\n");
|
|
||||||
if (files_from)
|
|
||||||
log_info ("note: ignoring option --files-from\n");
|
|
||||||
fname = argc ? *argv : NULL;
|
|
||||||
err = gpgtar_extract (fname, !skip_crypto);
|
|
||||||
if (err && log_get_errorcount (0) == 0)
|
|
||||||
log_error ("extracting archive failed: %s\n", gpg_strerror (err));
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
log_error (_("invalid command (there is no implicit command)\n"));
|
log_error (_("invalid command (there is no implicit command)\n"));
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user