1
0
Fork 0
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:
Werner Koch 2003-10-29 10:07:44 +00:00
parent be239a058a
commit fcc72f915b
8 changed files with 204 additions and 2 deletions

View file

@ -1,3 +1,7 @@
2003-10-29 Werner Koch <wk@gnupg.org>
* miscutil.c (answer_is_okay_cancel): New.
2003-10-25 Werner Koch <wk@gnupg.org>
* Makefile.am: Replaced INTLLIBS by LIBINTL.

View file

@ -359,3 +359,38 @@ answer_is_yes_no_quit( const char *s )
return -1;
return 0;
}
/*
Return 1 for okay, 0 for for cancel or DEF_ANSWER for default.
*/
int
answer_is_okay_cancel (const char *s, int def_answer)
{
const char *long_okay = _("okay");
const char *long_cancel = _("cancel");
const char *short_okay = _("oO");
const char *short_cancel = _("cC");
/* Note: We have to use the locale dependent strcasecmp */
if ( !strcasecmp(s, long_okay ) )
return 1;
if ( !strcasecmp(s, long_cancel ) )
return 0;
if ( *s && strchr( short_okay, *s ) && !s[1] )
return 1;
if ( *s && strchr( short_cancel, *s ) && !s[1] )
return 0;
/* Always test for the English values (not locale here) */
if ( !ascii_strcasecmp(s, "okay" ) )
return 1;
if ( !ascii_strcasecmp(s, "ok" ) )
return 1;
if ( !ascii_strcasecmp(s, "cancel" ) )
return 0;
if ( *s && strchr( "oO", *s ) && !s[1] )
return 1;
if ( *s && strchr( "cC", *s ) && !s[1] )
return 0;
return def_answer;
}