From 041c6d7261a83799df58c072ea7880ea0cdf76c4 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Wed, 11 Aug 2010 10:20:53 +0000 Subject: [PATCH] Support "-" for --output. --- tools/ChangeLog | 5 +++++ tools/gpgtar-create.c | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/tools/ChangeLog b/tools/ChangeLog index 252e7f972..c50e3a3bc 100644 --- a/tools/ChangeLog +++ b/tools/ChangeLog @@ -1,3 +1,8 @@ +2010-08-11 Werner Koch + + * gpgtar-create.c (gpgtar_create): Allow "-" for stdout in + opt.outfile. Switch es_stdout to binary mode. + 2010-08-09 Werner Koch * watchgnupg.c: Inlcude in.h and inet.h. diff --git a/tools/gpgtar-create.c b/tools/gpgtar-create.c index 7568c153a..3a18d7c69 100644 --- a/tools/gpgtar-create.c +++ b/tools/gpgtar-create.c @@ -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);