diff options
author | Werner Koch <[email protected]> | 2003-10-29 10:07:44 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2003-10-29 10:07:44 +0000 |
commit | fcc72f915bbafe2e1f1f68be7e79d7b45561da62 (patch) | |
tree | cabc573682cc56a710a40e251b33847d38ef1cb9 /g10/status.c | |
parent | * DETAILS: Add the 'a' value for field 12 and the new field 15. (diff) | |
download | gnupg-fcc72f915bbafe2e1f1f68be7e79d7b45561da62.tar.gz gnupg-fcc72f915bbafe2e1f1f68be7e79d7b45561da62.zip |
* cardglue.c (open_card): Ask for card insertion.
(check_card_serialno): New.
(agent_scd_pksign, agent_scd_pkdecrypt): Use it here.
* cardglue.c (open_card): Issue insertion status message.
* status.h, status.c (STATUS_CARDCTRL): New.
* status.c (cpr_get_answer_okay_cancel): New.
* miscutil.c (answer_is_okay_cancel): New.
Diffstat (limited to 'g10/status.c')
-rw-r--r-- | g10/status.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/g10/status.c b/g10/status.c index cde0c8d77..d39bc683b 100644 --- a/g10/status.c +++ b/g10/status.c @@ -150,6 +150,7 @@ get_status_string ( int no ) case STATUS_EXPKEYSIG : s = "EXPKEYSIG"; break; case STATUS_REVKEYSIG : s = "REVKEYSIG"; break; case STATUS_ATTRIBUTE : s = "ATTRIBUTE"; break; + case STATUS_CARDCTRL : s = "CARDCTRL"; break; default: s = "?"; break; } return s; @@ -692,3 +693,47 @@ cpr_get_answer_yes_no_quit( const char *keyword, const char *prompt ) } } } + + +int +cpr_get_answer_okay_cancel (const char *keyword, + const char *prompt, + int def_answer) +{ + int yes; + char *answer = NULL; + char *p; + + if( opt.command_fd != -1 ) + answer = do_get_from_fd ( keyword, 0, 0 ); +#ifdef USE_SHM_COPROCESSING + else if( opt.shm_coprocess ) + answer = do_shm_get( keyword, 0, 0 ); +#endif + + if (answer) + { + yes = answer_is_okay_cancel (answer, def_answer); + m_free (answer); + return yes; + } + + for(;;) + { + p = tty_get( prompt ); + trim_spaces(p); /* it is okay to do this here */ + if (*p == '?' && !p[1]) + { + m_free(p); + display_online_help (keyword); + } + else + { + tty_kill_prompt(); + yes = answer_is_okay_cancel (p, def_answer); + m_free(p); + return yes; + } + } +} + |