mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-23 10:29:58 +01:00
* Makefile.am (AM_CFLAGS): Make use of AM_CFLAGS and AM_LDFLAGS.
* g10.c, options.h: New option --enable-progress-filter. * progress.c (handle_progress): Make use of it.
This commit is contained in:
parent
fc3cc2cacf
commit
b394776a80
@ -1,3 +1,31 @@
|
|||||||
|
2003-04-15 Werner Koch <wk@gnupg.org>
|
||||||
|
|
||||||
|
* Makefile.am (AM_CFLAGS): Make use of AM_CFLAGS and AM_LDFLAGS.
|
||||||
|
|
||||||
|
* g10.c, options.h: New option --enable-progress-filter.
|
||||||
|
* progress.c (handle_progress): Make use of it.
|
||||||
|
|
||||||
|
2003-04-15 Marcus Brinkmann <marcus@g10code.de>
|
||||||
|
|
||||||
|
* progress.c: New file.
|
||||||
|
* Makefile.am (common_source): Add progress.c.
|
||||||
|
* filter.h (progress_filter_context_t): New type.
|
||||||
|
(progress_filter, handle_progress): New prototypes.
|
||||||
|
* main.h (open_sigfile): New argument for prototype.
|
||||||
|
* openfile.c (open_sigfile): New argument to install progress
|
||||||
|
filter.
|
||||||
|
* encode.c (encode_simple): New variable PFX. Register
|
||||||
|
progress filter. Install text_filter after that.
|
||||||
|
(encode_crypt): Likewise.
|
||||||
|
* sign.c (sign_file): Likewise.
|
||||||
|
(clearsign_file): Likewise.
|
||||||
|
* decrypt.c (decrypt_message): Likewise.
|
||||||
|
(decrypt_messages): Likewise.
|
||||||
|
* verify.c (verify_signatures): Likewise.
|
||||||
|
(verify_one_file): Likewise.
|
||||||
|
* plaintext.c (hash_datafiles): Likewise.
|
||||||
|
(ask_for_detached_datafile): Likewise.
|
||||||
|
|
||||||
2003-04-10 Werner Koch <wk@gnupg.org>
|
2003-04-10 Werner Koch <wk@gnupg.org>
|
||||||
|
|
||||||
* passphrase.c (read_passphrase_from_fd): Do a dummy read if the
|
* passphrase.c (read_passphrase_from_fd): Do a dummy read if the
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
|
# Copyright (C) 1998, 1999, 2000, 2001, 2002,
|
||||||
|
# 2003 Free Software Foundation, Inc.
|
||||||
#
|
#
|
||||||
# This file is part of GnuPG.
|
# This file is part of GnuPG.
|
||||||
#
|
#
|
||||||
@ -22,9 +23,10 @@ INCLUDES = -I.. -I$(top_srcdir)/include -I$(top_srcdir)/intl
|
|||||||
EXTRA_DIST = options.skel
|
EXTRA_DIST = options.skel
|
||||||
# it seems that we can't use this with automake 1.5
|
# it seems that we can't use this with automake 1.5
|
||||||
#OMIT_DEPENDENCIES = zlib.h zconf.h
|
#OMIT_DEPENDENCIES = zlib.h zconf.h
|
||||||
LDFLAGS = @LDFLAGS@
|
|
||||||
libexecdir = @libexecdir@/@PACKAGE@
|
libexecdir = @libexecdir@/@PACKAGE@
|
||||||
CFLAGS = @CFLAGS@ -DGNUPG_LIBEXECDIR="\"$(libexecdir)\""
|
if ! HAVE_DOSISH_SYSTEM
|
||||||
|
AM_CFLAGS = -DGNUPG_LIBEXECDIR="\"$(libexecdir)\""
|
||||||
|
endif
|
||||||
needed_libs = ../cipher/libcipher.a ../mpi/libmpi.a ../util/libutil.a @CAPLIBS@
|
needed_libs = ../cipher/libcipher.a ../mpi/libmpi.a ../util/libutil.a @CAPLIBS@
|
||||||
|
|
||||||
#noinst_PROGRAMS = gpgd
|
#noinst_PROGRAMS = gpgd
|
||||||
@ -46,6 +48,7 @@ common_source = \
|
|||||||
armor.c \
|
armor.c \
|
||||||
mdfilter.c \
|
mdfilter.c \
|
||||||
textfilter.c \
|
textfilter.c \
|
||||||
|
progress.c \
|
||||||
misc.c \
|
misc.c \
|
||||||
options.h \
|
options.h \
|
||||||
openfile.c \
|
openfile.c \
|
||||||
|
@ -51,6 +51,7 @@ decrypt_message( const char *filename )
|
|||||||
{
|
{
|
||||||
IOBUF fp;
|
IOBUF fp;
|
||||||
armor_filter_context_t afx;
|
armor_filter_context_t afx;
|
||||||
|
progress_filter_context_t pfx;
|
||||||
int rc;
|
int rc;
|
||||||
int no_out=0;
|
int no_out=0;
|
||||||
|
|
||||||
@ -61,6 +62,8 @@ decrypt_message( const char *filename )
|
|||||||
return G10ERR_OPEN_FILE;
|
return G10ERR_OPEN_FILE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handle_progress (&pfx, fp, filename);
|
||||||
|
|
||||||
if( !opt.no_armor ) {
|
if( !opt.no_armor ) {
|
||||||
if( use_armor_filter( fp ) ) {
|
if( use_armor_filter( fp ) ) {
|
||||||
memset( &afx, 0, sizeof afx);
|
memset( &afx, 0, sizeof afx);
|
||||||
@ -84,6 +87,7 @@ decrypt_messages(int nfiles, char **files)
|
|||||||
{
|
{
|
||||||
IOBUF fp;
|
IOBUF fp;
|
||||||
armor_filter_context_t afx;
|
armor_filter_context_t afx;
|
||||||
|
progress_filter_context_t pfx;
|
||||||
char *p, *output = NULL;
|
char *p, *output = NULL;
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
|
||||||
@ -106,6 +110,9 @@ decrypt_messages(int nfiles, char **files)
|
|||||||
log_error(_("can't open `%s'\n"), print_fname_stdin(*files));
|
log_error(_("can't open `%s'\n"), print_fname_stdin(*files));
|
||||||
goto next_file;
|
goto next_file;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handle_progress (&pfx, fp, *files);
|
||||||
|
|
||||||
if (!opt.no_armor)
|
if (!opt.no_armor)
|
||||||
{
|
{
|
||||||
if (use_armor_filter(fp))
|
if (use_armor_filter(fp))
|
||||||
|
@ -164,6 +164,7 @@ encode_simple( const char *filename, int mode, int compat )
|
|||||||
armor_filter_context_t afx;
|
armor_filter_context_t afx;
|
||||||
compress_filter_context_t zfx;
|
compress_filter_context_t zfx;
|
||||||
text_filter_context_t tfx;
|
text_filter_context_t tfx;
|
||||||
|
progress_filter_context_t pfx;
|
||||||
int do_compress = opt.compress && !opt.rfc1991;
|
int do_compress = opt.compress && !opt.rfc1991;
|
||||||
|
|
||||||
memset( &cfx, 0, sizeof cfx);
|
memset( &cfx, 0, sizeof cfx);
|
||||||
@ -179,6 +180,8 @@ encode_simple( const char *filename, int mode, int compat )
|
|||||||
return G10ERR_OPEN_FILE;
|
return G10ERR_OPEN_FILE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handle_progress (&pfx, inp, filename);
|
||||||
|
|
||||||
if( opt.textmode )
|
if( opt.textmode )
|
||||||
iobuf_push_filter( inp, text_filter, &tfx );
|
iobuf_push_filter( inp, text_filter, &tfx );
|
||||||
|
|
||||||
@ -386,6 +389,7 @@ encode_crypt( const char *filename, STRLIST remusr )
|
|||||||
armor_filter_context_t afx;
|
armor_filter_context_t afx;
|
||||||
compress_filter_context_t zfx;
|
compress_filter_context_t zfx;
|
||||||
text_filter_context_t tfx;
|
text_filter_context_t tfx;
|
||||||
|
progress_filter_context_t pfx;
|
||||||
PK_LIST pk_list,work_list;
|
PK_LIST pk_list,work_list;
|
||||||
int do_compress = opt.compress && !opt.rfc1991;
|
int do_compress = opt.compress && !opt.rfc1991;
|
||||||
|
|
||||||
@ -422,6 +426,8 @@ encode_crypt( const char *filename, STRLIST remusr )
|
|||||||
else if( opt.verbose )
|
else if( opt.verbose )
|
||||||
log_info(_("reading from `%s'\n"), filename? filename: "[stdin]");
|
log_info(_("reading from `%s'\n"), filename? filename: "[stdin]");
|
||||||
|
|
||||||
|
handle_progress (&pfx, inp, filename);
|
||||||
|
|
||||||
if( opt.textmode )
|
if( opt.textmode )
|
||||||
iobuf_push_filter( inp, text_filter, &tfx );
|
iobuf_push_filter( inp, text_filter, &tfx );
|
||||||
|
|
||||||
|
14
g10/filter.h
14
g10/filter.h
@ -109,6 +109,14 @@ typedef struct {
|
|||||||
} text_filter_context_t;
|
} text_filter_context_t;
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
char *what; /* description */
|
||||||
|
u32 last_time; /* last time reported */
|
||||||
|
unsigned long last; /* last amount reported */
|
||||||
|
unsigned long offset; /* current amount */
|
||||||
|
unsigned long total; /* total amount */
|
||||||
|
} progress_filter_context_t;
|
||||||
|
|
||||||
/* encrypt_filter_context_t defined in main.h */
|
/* encrypt_filter_context_t defined in main.h */
|
||||||
|
|
||||||
/*-- mdfilter.c --*/
|
/*-- mdfilter.c --*/
|
||||||
@ -137,6 +145,10 @@ int text_filter( void *opaque, int control,
|
|||||||
int copy_clearsig_text( IOBUF out, IOBUF inp, MD_HANDLE md,
|
int copy_clearsig_text( IOBUF out, IOBUF inp, MD_HANDLE md,
|
||||||
int escape_dash, int escape_from, int pgp2mode );
|
int escape_dash, int escape_from, int pgp2mode );
|
||||||
|
|
||||||
|
/*-- progress.c --*/
|
||||||
|
int progress_filter (void *opaque, int control,
|
||||||
|
IOBUF a, byte *buf, size_t *ret_len);
|
||||||
|
void handle_progress (progress_filter_context_t *pfx,
|
||||||
|
IOBUF inp, char *name);
|
||||||
|
|
||||||
#endif /*G10_FILTER_H*/
|
#endif /*G10_FILTER_H*/
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* g10.c - The GnuPG utility (main for gpg)
|
/* g10.c - The GnuPG utility (main for gpg)
|
||||||
* Copyright (C) 1998,1999,2000,2001,2002 Free Software Foundation, Inc.
|
* Copyright (C) 1998,1999,2000,2001,2002,2003 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* This file is part of GnuPG.
|
* This file is part of GnuPG.
|
||||||
*
|
*
|
||||||
@ -313,6 +313,7 @@ enum cmd_and_opt_values { aNull = 0,
|
|||||||
oNoStrict,
|
oNoStrict,
|
||||||
oMangleDosFilenames,
|
oMangleDosFilenames,
|
||||||
oNoMangleDosFilenames,
|
oNoMangleDosFilenames,
|
||||||
|
oEnableProgressFilter,
|
||||||
aTest };
|
aTest };
|
||||||
|
|
||||||
|
|
||||||
@ -616,6 +617,7 @@ static ARGPARSE_OPTS opts[] = {
|
|||||||
{ oNoStrict, "no-strict", 0, "@" },
|
{ oNoStrict, "no-strict", 0, "@" },
|
||||||
{ oMangleDosFilenames, "mangle-dos-filenames", 0, "@" },
|
{ oMangleDosFilenames, "mangle-dos-filenames", 0, "@" },
|
||||||
{ oNoMangleDosFilenames, "no-mangle-dos-filenames", 0, "@" },
|
{ oNoMangleDosFilenames, "no-mangle-dos-filenames", 0, "@" },
|
||||||
|
{ oEnableProgressFilter, "enable-progress-filter", 0, "@" },
|
||||||
{0} };
|
{0} };
|
||||||
|
|
||||||
|
|
||||||
@ -1818,6 +1820,8 @@ main( int argc, char **argv )
|
|||||||
case oMangleDosFilenames: opt.mangle_dos_filenames = 1; break;
|
case oMangleDosFilenames: opt.mangle_dos_filenames = 1; break;
|
||||||
case oNoMangleDosFilenames: opt.mangle_dos_filenames = 0; break;
|
case oNoMangleDosFilenames: opt.mangle_dos_filenames = 0; break;
|
||||||
|
|
||||||
|
case oEnableProgressFilter: opt.enable_progress_filter = 1; break;
|
||||||
|
|
||||||
default : pargs.err = configfp? 1:2; break;
|
default : pargs.err = configfp? 1:2; break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -146,7 +146,7 @@ int overwrite_filep( const char *fname );
|
|||||||
char *make_outfile_name( const char *iname );
|
char *make_outfile_name( const char *iname );
|
||||||
char *ask_outfile_name( const char *name, size_t namelen );
|
char *ask_outfile_name( const char *name, size_t namelen );
|
||||||
int open_outfile( const char *iname, int mode, IOBUF *a );
|
int open_outfile( const char *iname, int mode, IOBUF *a );
|
||||||
IOBUF open_sigfile( const char *iname );
|
IOBUF open_sigfile( const char *iname, progress_filter_context_t *pfx );
|
||||||
void try_make_homedir( const char *fname );
|
void try_make_homedir( const char *fname );
|
||||||
|
|
||||||
/*-- seskey.c --*/
|
/*-- seskey.c --*/
|
||||||
|
@ -264,7 +264,7 @@ open_outfile( const char *iname, int mode, IOBUF *a )
|
|||||||
* Return NULL if such a file is not available.
|
* Return NULL if such a file is not available.
|
||||||
*/
|
*/
|
||||||
IOBUF
|
IOBUF
|
||||||
open_sigfile( const char *iname )
|
open_sigfile( const char *iname, progress_filter_context_t *pfx )
|
||||||
{
|
{
|
||||||
IOBUF a = NULL;
|
IOBUF a = NULL;
|
||||||
size_t len;
|
size_t len;
|
||||||
@ -280,6 +280,9 @@ open_sigfile( const char *iname )
|
|||||||
a = iobuf_open( buf );
|
a = iobuf_open( buf );
|
||||||
if( a && opt.verbose )
|
if( a && opt.verbose )
|
||||||
log_info(_("assuming signed data in `%s'\n"), buf );
|
log_info(_("assuming signed data in `%s'\n"), buf );
|
||||||
|
if (a && pfx)
|
||||||
|
handle_progress (pfx, a, buf);
|
||||||
|
else
|
||||||
m_free(buf);
|
m_free(buf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
/* options.h
|
/* options.h
|
||||||
* Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
|
* Copyright (C) 1998, 1999, 2000, 2001, 2002,
|
||||||
|
* 2003 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* This file is part of GnuPG.
|
* This file is part of GnuPG.
|
||||||
*
|
*
|
||||||
@ -181,6 +182,7 @@ struct {
|
|||||||
struct groupitem *grouplist;
|
struct groupitem *grouplist;
|
||||||
int strict;
|
int strict;
|
||||||
int mangle_dos_filenames;
|
int mangle_dos_filenames;
|
||||||
|
int enable_progress_filter;
|
||||||
} opt;
|
} opt;
|
||||||
|
|
||||||
|
|
||||||
|
@ -357,11 +357,16 @@ int
|
|||||||
ask_for_detached_datafile( MD_HANDLE md, MD_HANDLE md2,
|
ask_for_detached_datafile( MD_HANDLE md, MD_HANDLE md2,
|
||||||
const char *inname, int textmode )
|
const char *inname, int textmode )
|
||||||
{
|
{
|
||||||
|
progress_filter_context_t pfx;
|
||||||
|
int dealloc_pfx_name = 1;
|
||||||
char *answer = NULL;
|
char *answer = NULL;
|
||||||
IOBUF fp;
|
IOBUF fp;
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
|
||||||
fp = open_sigfile( inname ); /* open default file */
|
fp = open_sigfile( inname, &pfx ); /* open default file */
|
||||||
|
if (!fp)
|
||||||
|
dealloc_pfx_name = 0;
|
||||||
|
|
||||||
if( !fp && !opt.batch ) {
|
if( !fp && !opt.batch ) {
|
||||||
int any=0;
|
int any=0;
|
||||||
tty_printf(_("Detached signature.\n"));
|
tty_printf(_("Detached signature.\n"));
|
||||||
@ -395,7 +400,8 @@ ask_for_detached_datafile( MD_HANDLE md, MD_HANDLE md2,
|
|||||||
}
|
}
|
||||||
do_hash( md, md2, fp, textmode );
|
do_hash( md, md2, fp, textmode );
|
||||||
iobuf_close(fp);
|
iobuf_close(fp);
|
||||||
|
if (dealloc_pfx_name)
|
||||||
|
m_free (pfx.what);
|
||||||
|
|
||||||
leave:
|
leave:
|
||||||
m_free(answer);
|
m_free(answer);
|
||||||
@ -412,15 +418,17 @@ int
|
|||||||
hash_datafiles( MD_HANDLE md, MD_HANDLE md2, STRLIST files,
|
hash_datafiles( MD_HANDLE md, MD_HANDLE md2, STRLIST files,
|
||||||
const char *sigfilename, int textmode )
|
const char *sigfilename, int textmode )
|
||||||
{
|
{
|
||||||
|
progress_filter_context_t pfx;
|
||||||
IOBUF fp;
|
IOBUF fp;
|
||||||
STRLIST sl;
|
STRLIST sl;
|
||||||
|
|
||||||
if( !files ) {
|
if( !files ) {
|
||||||
/* check whether we can open the signed material */
|
/* check whether we can open the signed material */
|
||||||
fp = open_sigfile( sigfilename );
|
fp = open_sigfile( sigfilename, &pfx );
|
||||||
if( fp ) {
|
if( fp ) {
|
||||||
do_hash( md, md2, fp, textmode );
|
do_hash( md, md2, fp, textmode );
|
||||||
iobuf_close(fp);
|
iobuf_close(fp);
|
||||||
|
m_free (pfx.what);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
log_error (_("no signed data\n"));
|
log_error (_("no signed data\n"));
|
||||||
@ -435,6 +443,7 @@ hash_datafiles( MD_HANDLE md, MD_HANDLE md2, STRLIST files,
|
|||||||
print_fname_stdin(sl->d));
|
print_fname_stdin(sl->d));
|
||||||
return G10ERR_OPEN_FILE;
|
return G10ERR_OPEN_FILE;
|
||||||
}
|
}
|
||||||
|
handle_progress (&pfx, fp, sl->d);
|
||||||
do_hash( md, md2, fp, textmode );
|
do_hash( md, md2, fp, textmode );
|
||||||
iobuf_close(fp);
|
iobuf_close(fp);
|
||||||
}
|
}
|
||||||
|
104
g10/progress.c
Normal file
104
g10/progress.c
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
/* progress.c
|
||||||
|
* Copyright (C) 2003 Free Software Foundation, Inc.
|
||||||
|
*
|
||||||
|
* This file is part of GnuPG.
|
||||||
|
*
|
||||||
|
* GnuPG is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GnuPG is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <config.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include "iobuf.h"
|
||||||
|
#include "filter.h"
|
||||||
|
#include "status.h"
|
||||||
|
#include "options.h"
|
||||||
|
|
||||||
|
/****************
|
||||||
|
* The filter is used to report progress to the user.
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
progress_filter (void *opaque, int control,
|
||||||
|
IOBUF a, byte *buf, size_t *ret_len)
|
||||||
|
{
|
||||||
|
int rc = 0;
|
||||||
|
progress_filter_context_t *pfx = opaque;
|
||||||
|
|
||||||
|
if (control == IOBUFCTRL_INIT)
|
||||||
|
{
|
||||||
|
char buffer[50];
|
||||||
|
|
||||||
|
pfx->last = 0;
|
||||||
|
pfx->offset = 0;
|
||||||
|
pfx->last_time = make_timestamp ();
|
||||||
|
|
||||||
|
sprintf (buffer, "%.20s ? %lu %lu", pfx->what, pfx->offset,
|
||||||
|
pfx->total);
|
||||||
|
write_status_text (STATUS_PROGRESS, buffer);
|
||||||
|
}
|
||||||
|
else if (control == IOBUFCTRL_UNDERFLOW)
|
||||||
|
{
|
||||||
|
u32 timestamp = make_timestamp ();
|
||||||
|
int len = iobuf_read (a, buf, *ret_len);
|
||||||
|
|
||||||
|
if (len >= 0)
|
||||||
|
{
|
||||||
|
pfx->offset += len;
|
||||||
|
*ret_len = len;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
*ret_len = 0;
|
||||||
|
rc = -1;
|
||||||
|
}
|
||||||
|
if ((len == -1 && pfx->offset != pfx->last)
|
||||||
|
|| timestamp - pfx->last_time > 0)
|
||||||
|
{
|
||||||
|
char buffer[50];
|
||||||
|
|
||||||
|
sprintf (buffer, "%.20s ? %lu %lu", pfx->what, pfx->offset,
|
||||||
|
pfx->total);
|
||||||
|
write_status_text (STATUS_PROGRESS, buffer);
|
||||||
|
|
||||||
|
pfx->last = pfx->offset;
|
||||||
|
pfx->last_time = timestamp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (control == IOBUFCTRL_DESC)
|
||||||
|
*(char**)buf = "progress_filter";
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
handle_progress (progress_filter_context_t *pfx, IOBUF inp, char *name)
|
||||||
|
{
|
||||||
|
off_t filesize = 0;
|
||||||
|
|
||||||
|
if (!opt.enable_progress_filter)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!is_status_enabled ())
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (name)
|
||||||
|
filesize = iobuf_get_filelength (inp);
|
||||||
|
else if (opt.set_filesize)
|
||||||
|
filesize = opt.set_filesize;
|
||||||
|
|
||||||
|
/* register the progress filter */
|
||||||
|
pfx->what = name ? name : "stdin";
|
||||||
|
pfx->total = filesize;
|
||||||
|
iobuf_push_filter (inp, progress_filter, pfx);
|
||||||
|
}
|
12
g10/sign.c
12
g10/sign.c
@ -631,6 +631,7 @@ sign_file( STRLIST filenames, int detached, STRLIST locusr,
|
|||||||
compress_filter_context_t zfx;
|
compress_filter_context_t zfx;
|
||||||
md_filter_context_t mfx;
|
md_filter_context_t mfx;
|
||||||
text_filter_context_t tfx;
|
text_filter_context_t tfx;
|
||||||
|
progress_filter_context_t pfx;
|
||||||
encrypt_filter_context_t efx;
|
encrypt_filter_context_t efx;
|
||||||
IOBUF inp = NULL, out = NULL;
|
IOBUF inp = NULL, out = NULL;
|
||||||
PACKET pkt;
|
PACKET pkt;
|
||||||
@ -677,13 +678,17 @@ sign_file( STRLIST filenames, int detached, STRLIST locusr,
|
|||||||
/* prepare iobufs */
|
/* prepare iobufs */
|
||||||
if( multifile ) /* have list of filenames */
|
if( multifile ) /* have list of filenames */
|
||||||
inp = NULL; /* we do it later */
|
inp = NULL; /* we do it later */
|
||||||
else if( !(inp = iobuf_open(fname)) ) {
|
else {
|
||||||
|
if( !(inp = iobuf_open(fname)) ) {
|
||||||
log_error("can't open %s: %s\n", fname? fname: "[stdin]",
|
log_error("can't open %s: %s\n", fname? fname: "[stdin]",
|
||||||
strerror(errno) );
|
strerror(errno) );
|
||||||
rc = G10ERR_OPEN_FILE;
|
rc = G10ERR_OPEN_FILE;
|
||||||
goto leave;
|
goto leave;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handle_progress (&pfx, inp, fname);
|
||||||
|
}
|
||||||
|
|
||||||
if( outfile ) {
|
if( outfile ) {
|
||||||
if( !(out = iobuf_create( outfile )) ) {
|
if( !(out = iobuf_create( outfile )) ) {
|
||||||
log_error(_("can't create %s: %s\n"), outfile, strerror(errno) );
|
log_error(_("can't create %s: %s\n"), outfile, strerror(errno) );
|
||||||
@ -819,6 +824,7 @@ sign_file( STRLIST filenames, int detached, STRLIST locusr,
|
|||||||
rc = G10ERR_OPEN_FILE;
|
rc = G10ERR_OPEN_FILE;
|
||||||
goto leave;
|
goto leave;
|
||||||
}
|
}
|
||||||
|
handle_progress (&pfx, inp, sl->d);
|
||||||
if( opt.verbose )
|
if( opt.verbose )
|
||||||
fprintf(stderr, " `%s'", sl->d );
|
fprintf(stderr, " `%s'", sl->d );
|
||||||
if(opt.textmode)
|
if(opt.textmode)
|
||||||
@ -882,6 +888,7 @@ int
|
|||||||
clearsign_file( const char *fname, STRLIST locusr, const char *outfile )
|
clearsign_file( const char *fname, STRLIST locusr, const char *outfile )
|
||||||
{
|
{
|
||||||
armor_filter_context_t afx;
|
armor_filter_context_t afx;
|
||||||
|
progress_filter_context_t pfx;
|
||||||
MD_HANDLE textmd = NULL;
|
MD_HANDLE textmd = NULL;
|
||||||
IOBUF inp = NULL, out = NULL;
|
IOBUF inp = NULL, out = NULL;
|
||||||
PACKET pkt;
|
PACKET pkt;
|
||||||
@ -919,6 +926,7 @@ clearsign_file( const char *fname, STRLIST locusr, const char *outfile )
|
|||||||
rc = G10ERR_OPEN_FILE;
|
rc = G10ERR_OPEN_FILE;
|
||||||
goto leave;
|
goto leave;
|
||||||
}
|
}
|
||||||
|
handle_progress (&pfx, inp, fname);
|
||||||
|
|
||||||
if( outfile ) {
|
if( outfile ) {
|
||||||
if( !(out = iobuf_create( outfile )) ) {
|
if( !(out = iobuf_create( outfile )) ) {
|
||||||
@ -1014,6 +1022,7 @@ int
|
|||||||
sign_symencrypt_file (const char *fname, STRLIST locusr)
|
sign_symencrypt_file (const char *fname, STRLIST locusr)
|
||||||
{
|
{
|
||||||
armor_filter_context_t afx;
|
armor_filter_context_t afx;
|
||||||
|
progress_filter_context_t pfx;
|
||||||
compress_filter_context_t zfx;
|
compress_filter_context_t zfx;
|
||||||
md_filter_context_t mfx;
|
md_filter_context_t mfx;
|
||||||
text_filter_context_t tfx;
|
text_filter_context_t tfx;
|
||||||
@ -1049,6 +1058,7 @@ sign_symencrypt_file (const char *fname, STRLIST locusr)
|
|||||||
rc = G10ERR_OPEN_FILE;
|
rc = G10ERR_OPEN_FILE;
|
||||||
goto leave;
|
goto leave;
|
||||||
}
|
}
|
||||||
|
handle_progress (&pfx, inp, fname);
|
||||||
|
|
||||||
/* prepare key */
|
/* prepare key */
|
||||||
s2k = m_alloc_clear( sizeof *s2k );
|
s2k = m_alloc_clear( sizeof *s2k );
|
||||||
|
@ -56,6 +56,7 @@ verify_signatures( int nfiles, char **files )
|
|||||||
{
|
{
|
||||||
IOBUF fp;
|
IOBUF fp;
|
||||||
armor_filter_context_t afx;
|
armor_filter_context_t afx;
|
||||||
|
progress_filter_context_t pfx;
|
||||||
const char *sigfile;
|
const char *sigfile;
|
||||||
int i, rc;
|
int i, rc;
|
||||||
STRLIST sl;
|
STRLIST sl;
|
||||||
@ -94,6 +95,7 @@ verify_signatures( int nfiles, char **files )
|
|||||||
log_error(_("can't open `%s'\n"), print_fname_stdin(sigfile));
|
log_error(_("can't open `%s'\n"), print_fname_stdin(sigfile));
|
||||||
return G10ERR_OPEN_FILE;
|
return G10ERR_OPEN_FILE;
|
||||||
}
|
}
|
||||||
|
handle_progress (&pfx, fp, sigfile);
|
||||||
|
|
||||||
if( !opt.no_armor && use_armor_filter( fp ) )
|
if( !opt.no_armor && use_armor_filter( fp ) )
|
||||||
iobuf_push_filter( fp, armor_filter, &afx );
|
iobuf_push_filter( fp, armor_filter, &afx );
|
||||||
@ -130,6 +132,7 @@ verify_one_file( const char *name )
|
|||||||
{
|
{
|
||||||
IOBUF fp;
|
IOBUF fp;
|
||||||
armor_filter_context_t afx;
|
armor_filter_context_t afx;
|
||||||
|
progress_filter_context_t pfx;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
print_file_status( STATUS_FILE_START, name, 1 );
|
print_file_status( STATUS_FILE_START, name, 1 );
|
||||||
@ -139,6 +142,7 @@ verify_one_file( const char *name )
|
|||||||
log_error(_("can't open `%s'\n"), print_fname_stdin(name));
|
log_error(_("can't open `%s'\n"), print_fname_stdin(name));
|
||||||
return G10ERR_OPEN_FILE;
|
return G10ERR_OPEN_FILE;
|
||||||
}
|
}
|
||||||
|
handle_progress (&pfx, fp, name);
|
||||||
|
|
||||||
if( !opt.no_armor ) {
|
if( !opt.no_armor ) {
|
||||||
if( use_armor_filter( fp ) ) {
|
if( use_armor_filter( fp ) ) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user