diff options
author | Werner Koch <wk@gnupg.org> | 2010-08-25 12:31:47 +0200 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2010-08-25 12:31:47 +0200 |
commit | 789732e05a829136236e08398a2486d5c50d69ba (patch) | |
tree | 3604459063137465d90bb88f9cb351b28c4c2784 /tools/gpgtar-extract.c | |
parent | gpgconf does now work for Wince. (diff) | |
download | gnupg2-789732e05a829136236e08398a2486d5c50d69ba.tar.xz gnupg2-789732e05a829136236e08398a2486d5c50d69ba.zip |
Changed option names.
Add O_BINARY for stdin and stdout.
Diffstat (limited to 'tools/gpgtar-extract.c')
-rw-r--r-- | tools/gpgtar-extract.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/tools/gpgtar-extract.c b/tools/gpgtar-extract.c index 028ac0df4..af8d1aeb7 100644 --- a/tools/gpgtar-extract.c +++ b/tools/gpgtar-extract.c @@ -79,7 +79,7 @@ extract_regular (estream_t stream, const char *dirname, leave: if (!err && opt.verbose) - log_info ("extracted `%s/'\n", fname); + log_info ("extracted `%s'\n", fname); es_fclose (outfp); if (err && fname && outfp) { @@ -270,7 +270,10 @@ gpgtar_extract (const char *filename) if (filename) { - stream = es_fopen (filename, "rb"); + if (!strcmp (filename, "-")) + stream = es_stdout; + else + stream = es_fopen (filename, "rb"); if (!stream) { err = gpg_error_from_syserror (); @@ -279,20 +282,26 @@ gpgtar_extract (const char *filename) } } else - stream = es_stdin; /* FIXME: How can we enforce binary mode? */ + stream = es_stdin; + if (stream == es_stdin) + es_set_binary (es_stdin); if (filename) { dirprefix = strrchr (filename, '/'); if (dirprefix) dirprefix++; + else + dirprefix = filename; } else if (opt.filename) { dirprefix = strrchr (opt.filename, '/'); if (dirprefix) dirprefix++; + else + dirprefix = opt.filename; } if (!dirprefix || !*dirprefix) |