[PATCH] gpgv: overwrite by default and enable special file descriptors

Daniel Kahn Gillmor dkg at fifthhorseman.net
Thu Sep 8 15:21:26 CEST 2016


* g10/gpgv.c (main): default to overwriting files with gpgv --output,
  and enable special filenames.
* doc/gpgv.texi: document these changes.

Signed-off-by: Daniel Kahn Gillmor <dkg at fifthhorseman.net>
---
 doc/gpgv.texi | 11 +++++++----
 g10/gpgv.c    |  6 ++----
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/doc/gpgv.texi b/doc/gpgv.texi
index 6676bde..668b97b 100644
--- a/doc/gpgv.texi
+++ b/doc/gpgv.texi
@@ -95,12 +95,15 @@ home-directory ("~/.gnupg" if --homedir is not used).
 @item --output @var{file}
 @itemx -o @var{file}
 @opindex output
-Write output to @var{file}.  This option can be used to get the signed
+Write data to @var{file}.  This option can be used to get the signed
 text from a cleartext or binary signature; it also works for detached
 signatures, but in that case this option is in general not
-useful. Unless you write to stdout (using @code{-} for @var{file}) you
-should also use the option @option{--yes} to force overwriting an
-existing file.
+useful. To write to stdout, use @code{-} for @var{file}.  To
+write to any file descriptor, use the form @file{-&n}, where n is a
+non-negative decimal number.
+
+Note that @var{gpgv} will overwrite any @{file} identified by
+ at code{--output} if @var{file} already exists.
 
 @item --status-fd @var{n}
 @opindex status-fd
diff --git a/g10/gpgv.c b/g10/gpgv.c
index aa1fcea..d19b28f 100644
--- a/g10/gpgv.c
+++ b/g10/gpgv.c
@@ -63,8 +63,6 @@ enum cmd_and_opt_values {
   oLoggerFD,
   oHomedir,
   oWeakDigest,
-  oAnswerYes,
-  oAnswerNo,
   aTest
 };
 
@@ -85,7 +83,6 @@ static ARGPARSE_OPTS opts[] = {
   ARGPARSE_s_s (oHomedir, "homedir", "@"),
   ARGPARSE_s_s (oWeakDigest, "weak-digest",
                 N_("|ALGO|reject signatures made with ALGO")),
-  ARGPARSE_s_n (oAnswerYes, "yes", "@"),
 
   ARGPARSE_end ()
 };
@@ -170,6 +167,8 @@ main( int argc, char **argv )
   opt.no_sig_cache = 1;
   opt.flags.require_cross_cert = 1;
   opt.batch = 1;
+  opt.answer_yes = 1;
+  iobuf_enable_special_filenames (1);
 
   opt.weak_digests = NULL;
 
@@ -194,7 +193,6 @@ main( int argc, char **argv )
           break;
         case oKeyring: append_to_strlist( &nrings, pargs.r.ret_str); break;
         case oOutput: opt.outfile = pargs.r.ret_str; break;
-        case oAnswerYes: opt.answer_yes = 1; break;
         case oStatusFD: set_status_fd( pargs.r.ret_int ); break;
         case oLoggerFD:
           log_set_fd (translate_sys2libc_fd_int (pargs.r.ret_int, 1));
-- 
2.9.3




More information about the Gnupg-devel mailing list