mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
gpgtar: Emit progress status lines in create mode.
* tools/gpgtar.h (opt): Add field status_stream. * tools/gpgtar.c (main): Set status_stream. * tools/gpgtar-create.c (global_header_count): Rename to global_total_files. (global_written_files): New. (global_total_data, global_written_data): New. (struct scanctrl_s): Add field file_count. (write_progress): New. (write_file): Add arg skipped_open. Don't bail out immediatly on open error. Write progress lines. (gpgtar_create): Write progress lines. Print info aout skipped files. -- GnuPG-bug-id: 6363
This commit is contained in:
parent
d5fe8ba721
commit
f84264e8ac
4 changed files with 142 additions and 13 deletions
|
@ -491,6 +491,32 @@ main (int argc, char **argv)
|
|||
log_info (_("NOTE: '%s' is not considered an option\n"), argv[i]);
|
||||
}
|
||||
|
||||
/* Set status stream for our own use of --status-fd. The original
|
||||
* status fd is passed verbatim to gpg. */
|
||||
if (opt.status_fd)
|
||||
{
|
||||
int fd = translate_sys2libc_fd_int (opt.status_fd, 1);
|
||||
|
||||
if (!gnupg_fd_valid (fd))
|
||||
log_fatal ("status-fd is invalid: %s\n", strerror (errno));
|
||||
|
||||
if (fd == 1)
|
||||
opt.status_stream = es_stdout;
|
||||
else if (fd == 2)
|
||||
opt.status_stream = es_stderr;
|
||||
else
|
||||
{
|
||||
opt.status_stream = es_fdopen (fd, "w");
|
||||
if (opt.status_stream)
|
||||
es_setvbuf (opt.status_stream, NULL, _IOLBF, 0);
|
||||
}
|
||||
if (!opt.status_stream)
|
||||
{
|
||||
log_fatal ("can't open fd %d for status output: %s\n",
|
||||
fd, strerror (errno));
|
||||
}
|
||||
}
|
||||
|
||||
if (! opt.gpg_program)
|
||||
opt.gpg_program = gnupg_module_name (GNUPG_MODULE_NAME_GPG);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue