Support "-" for --output.
authorWerner Koch <wk@gnupg.org>
Wed, 11 Aug 2010 10:20:53 +0000 (10:20 +0000)
committerWerner Koch <wk@gnupg.org>
Wed, 11 Aug 2010 10:20:53 +0000 (10:20 +0000)
tools/ChangeLog
tools/gpgtar-create.c

index 252e7f9..c50e3a3 100644 (file)
@@ -1,3 +1,8 @@
+2010-08-11  Werner Koch  <wk@g10code.com>
+
+       * gpgtar-create.c (gpgtar_create): Allow "-" for stdout in
+       opt.outfile.  Switch es_stdout to binary mode.
+
 2010-08-09  Werner Koch  <wk@g10code.com>
 
        * watchgnupg.c: Inlcude in.h and inet.h.
index 7568c15..3a18d7c 100644 (file)
@@ -843,7 +843,10 @@ gpgtar_create (char **inpattern)
 
   if (opt.outfile)
     {
-      outstream = es_fopen (opt.outfile, "wb");
+      if (!strcmp (opt.outfile, "-"))
+        outstream = es_stdout;
+      else
+        outstream = es_fopen (opt.outfile, "wb");
       if (!outstream)
         {
           err = gpg_error_from_syserror ();
@@ -857,6 +860,9 @@ gpgtar_create (char **inpattern)
       outstream = es_stdout;
     }
 
+  if (outstream == es_stdout)
+    es_set_binary (es_stdout);
+
   for (hdr = scanctrl->flist; hdr; hdr = hdr->next)
     {
       err = write_file (outstream, hdr);