diff options
author | Werner Koch <wk@gnupg.org> | 2006-10-05 13:06:42 +0200 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2006-10-05 13:06:42 +0200 |
commit | 158a69aff7b75fa3a6bd5e6990520852c602ae03 (patch) | |
tree | ac99d3084ba3aa1bf33fa245bff546a6afa85092 /g10/status.c | |
parent | * gpgrlhelp.c: readline requires stdio.h. (diff) | |
download | gnupg2-158a69aff7b75fa3a6bd5e6990520852c602ae03.tar.xz gnupg2-158a69aff7b75fa3a6bd5e6990520852c602ae03.zip |
bug fixes
Diffstat (limited to 'g10/status.c')
-rw-r--r-- | g10/status.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/g10/status.c b/g10/status.c index 2098d6738..b0d0cd74c 100644 --- a/g10/status.c +++ b/g10/status.c @@ -45,15 +45,17 @@ static FILE *statusfp; static void -progress_cb ( void *ctx, int c ) +progress_cb (void *ctx, const char *what, int printchar, + int current, int total) { - char buf[50]; - - if ( c == '\n' ) - sprintf ( buf, "%.20s X 100 100", (char*)ctx ); - else - sprintf ( buf, "%.20s %c 0 0", (char*)ctx, c ); - write_status_text ( STATUS_PROGRESS, buf ); + char buf[50]; + + if ( printchar == '\n' && !strcmp (what, "primegen") ) + snprintf (buf, sizeof buf -1, "%.20s X 100 100", what ); + else + snprintf (buf, sizeof buf -1, "%.20s %c %d %d", + what, printchar=='\n'?'X':printchar, current, total ); + write_status_text (STATUS_PROGRESS, buf); } static const char * @@ -209,10 +211,8 @@ set_status_fd ( int fd ) fd, strerror(errno)); } last_fd = fd; -#warning Use libgrypt calls for progress indicators -/* register_primegen_progress ( progress_cb, "primegen" ); */ -/* register_pk_dsa_progress ( progress_cb, "pk_dsa" ); */ -/* register_pk_elg_progress ( progress_cb, "pk_elg" ); */ + + gcry_set_progress_handler ( progress_cb, NULL ); } int |