1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-06-06 23:17:47 +02:00

gpg: Print PROGRESS status lines during key generation.

* g10/call-agent.c (cache_nonce_status_cb): Rewrite by using
has_leading_keyword.  Handle PROGRESS lines.
--

GnuPG-bug-id: 1415
Co-authored-by: Daiki Ueno <ueno@gnu.org>
Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2016-01-25 11:34:49 +01:00
parent ee87c653bf
commit fbe1cf67aa
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B

View File

@ -1749,30 +1749,29 @@ static gpg_error_t
cache_nonce_status_cb (void *opaque, const char *line) cache_nonce_status_cb (void *opaque, const char *line)
{ {
struct cache_nonce_parm_s *parm = opaque; struct cache_nonce_parm_s *parm = opaque;
const char *keyword = line; const char *s;
int keywordlen;
for (keywordlen=0; *line && !spacep (line); line++, keywordlen++) if ((s = has_leading_keyword (line, "CACHE_NONCE")))
;
while (spacep (line))
line++;
if (keywordlen == 11 && !memcmp (keyword, "CACHE_NONCE", keywordlen))
{ {
if (parm->cache_nonce_addr) if (parm->cache_nonce_addr)
{ {
xfree (*parm->cache_nonce_addr); xfree (*parm->cache_nonce_addr);
*parm->cache_nonce_addr = xtrystrdup (line); *parm->cache_nonce_addr = xtrystrdup (s);
} }
} }
else if (keywordlen == 12 && !memcmp (keyword, "PASSWD_NONCE", keywordlen)) else if ((s = has_leading_keyword (line, "PASSWD_NONCE")))
{ {
if (parm->passwd_nonce_addr) if (parm->passwd_nonce_addr)
{ {
xfree (*parm->passwd_nonce_addr); xfree (*parm->passwd_nonce_addr);
*parm->passwd_nonce_addr = xtrystrdup (line); *parm->passwd_nonce_addr = xtrystrdup (s);
} }
} }
else if ((s = has_leading_keyword (line, "PROGRESS")))
{
if (opt.enable_progress_filter)
write_status_text (STATUS_PROGRESS, s);
}
return 0; return 0;
} }