mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
* 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.
This commit is contained in:
parent
be239a058a
commit
fcc72f915b
8 changed files with 204 additions and 2 deletions
45
g10/status.c
45
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue