aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Shaw <[email protected]>2002-04-23 17:22:11 +0000
committerDavid Shaw <[email protected]>2002-04-23 17:22:11 +0000
commitaf5e83329e83f288ff5035e1d4d7bb95fc10faef (patch)
tree420c82d31a06d7c82a48eb1b3c883778c6755721
parent* util.h: New function answer_is_yes_no_default() to give a default (diff)
downloadgnupg-af5e83329e83f288ff5035e1d4d7bb95fc10faef.tar.gz
gnupg-af5e83329e83f288ff5035e1d4d7bb95fc10faef.zip
* miscutil.c: New function answer_is_yes_no_default() to give a default
answer.
-rw-r--r--util/ChangeLog5
-rw-r--r--util/miscutil.c10
2 files changed, 12 insertions, 3 deletions
diff --git a/util/ChangeLog b/util/ChangeLog
index dcb62a4e7..edc261806 100644
--- a/util/ChangeLog
+++ b/util/ChangeLog
@@ -1,3 +1,8 @@
+2002-04-23 David Shaw <[email protected]>
+
+ * miscutil.c: New function answer_is_yes_no_default() to give a
+ default answer.
+
2002-04-22 Stefan Bellon <[email protected]>
* riscos.c (riscos_open, riscos_fopen, riscos_fstat, set_filetype):
diff --git a/util/miscutil.c b/util/miscutil.c
index d6a10cb19..276954234 100644
--- a/util/miscutil.c
+++ b/util/miscutil.c
@@ -290,9 +290,8 @@ make_printable_string( const byte *p, size_t n, int delim )
return buffer;
}
-
int
-answer_is_yes( const char *s )
+answer_is_yes_no_default( const char *s, int def_answer )
{
const char *long_yes = _("yes");
const char *short_yes = _("yY");
@@ -314,9 +313,14 @@ answer_is_yes( const char *s )
return 1;
if( *s && strchr( "yY", *s ) && !s[1] )
return 1;
- return 0;
+ return def_answer;
}
+int
+answer_is_yes( const char *s )
+{
+ return answer_is_yes_no_default(s,0);
+}
/****************
* Return 1 for yes, -1 for quit, or 0 for no