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 + + * miscutil.c: New function answer_is_yes_no_default() to give a + default answer. + 2002-04-22 Stefan Bellon * 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