From 75127bc4561787aa9bc1cf976658e20192446d7f Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Wed, 23 Jul 2014 14:35:22 +0200 Subject: [PATCH] common: Add cpr_get_answer_is_yes_def() * g10/cpr.c (cpr_get_answer_is_yes): Factor code out to .... (cpr_get_answer_is_yes_def): ...new. --- g10/cpr.c | 10 ++++++++-- g10/main.h | 2 ++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/g10/cpr.c b/g10/cpr.c index 99c8eecb0..9fc9e0995 100644 --- a/g10/cpr.c +++ b/g10/cpr.c @@ -493,7 +493,7 @@ cpr_kill_prompt(void) } int -cpr_get_answer_is_yes( const char *keyword, const char *prompt ) +cpr_get_answer_is_yes_def (const char *keyword, const char *prompt, int def_yes) { int yes; char *p; @@ -509,13 +509,19 @@ cpr_get_answer_is_yes( const char *keyword, const char *prompt ) } else { tty_kill_prompt(); - yes = answer_is_yes(p); + yes = answer_is_yes_no_default (p, def_yes); xfree(p); return yes; } } } +int +cpr_get_answer_is_yes (const char *keyword, const char *prompt) +{ + return cpr_get_answer_is_yes_def (keyword, prompt, 0); +} + int cpr_get_answer_yes_no_quit( const char *keyword, const char *prompt ) { diff --git a/g10/main.h b/g10/main.h index e75f6168f..d39c7c853 100644 --- a/g10/main.h +++ b/g10/main.h @@ -191,6 +191,8 @@ char *cpr_get_no_help( const char *keyword, const char *prompt ); char *cpr_get_utf8( const char *keyword, const char *prompt ); char *cpr_get_hidden( const char *keyword, const char *prompt ); void cpr_kill_prompt(void); +int cpr_get_answer_is_yes_def (const char *keyword, const char *prompt, + int def_yes); int cpr_get_answer_is_yes( const char *keyword, const char *prompt ); int cpr_get_answer_yes_no_quit( const char *keyword, const char *prompt ); int cpr_get_answer_okay_cancel (const char *keyword,