Support "-" for --output.

This commit is contained in:
Werner Koch 2010-08-11 10:20:53 +00:00
parent fa3120a1bc
commit 041c6d7261
2 changed files with 12 additions and 1 deletions

View 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.

View 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);