aboutsummaryrefslogtreecommitdiffstats
path: root/util/miscutil.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>1999-08-30 18:48:57 +0000
committerWerner Koch <[email protected]>1999-08-30 18:48:57 +0000
commitc2c397bedfe748472a3d1045f24a79a062e7fa5e (patch)
tree2b0613d28783e42e76908d848167f0244dcbeb88 /util/miscutil.c
parentSee ChangeLog: Wed Aug 4 10:34:46 CEST 1999 Werner Koch (diff)
downloadgnupg-c2c397bedfe748472a3d1045f24a79a062e7fa5e.tar.gz
gnupg-c2c397bedfe748472a3d1045f24a79a062e7fa5e.zip
See ChangeLog: Mon Aug 30 20:38:33 CEST 1999 Werner Koch
Diffstat (limited to 'util/miscutil.c')
-rw-r--r--util/miscutil.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/util/miscutil.c b/util/miscutil.c
index b0a6410e8..2b95d97d6 100644
--- a/util/miscutil.c
+++ b/util/miscutil.c
@@ -253,11 +253,23 @@ answer_is_yes( const char *s )
{
char *long_yes = _("yes");
char *short_yes = _("yY");
+ char *long_no = _("no");
+ char *short_no = _("nN");
if( !stricmp(s, long_yes ) )
return 1;
if( strchr( short_yes, *s ) && !s[1] )
return 1;
+ /* test for no strings to catch ambiguities for the next test */
+ if( !stricmp(s, long_no ) )
+ return 0;
+ if( strchr( short_no, *s ) && !s[1] )
+ return 0;
+ /* test for the english version (for those who are used to type yes) */
+ if( !stricmp(s, "yes" ) )
+ return 1;
+ if( strchr( "yY", *s ) && !s[1] )
+ return 1;
return 0;
}
@@ -269,18 +281,32 @@ int
answer_is_yes_no_quit( const char *s )
{
char *long_yes = _("yes");
+ char *long_no = _("no");
char *long_quit = _("quit");
char *short_yes = _("yY");
+ char *short_no = _("nN");
char *short_quit = _("qQ");
if( !stricmp(s, long_yes ) )
return 1;
+ if( !stricmp(s, long_no ) )
+ return 0;
if( !stricmp(s, long_quit ) )
return -1;
if( strchr( short_yes, *s ) && !s[1] )
return 1;
+ if( strchr( short_no, *s ) && !s[1] )
+ return 0;
if( strchr( short_quit, *s ) && !s[1] )
return -1;
+ if( !stricmp(s, "yes" ) )
+ return 1;
+ if( !stricmp(s, "quit" ) )
+ return -1;
+ if( strchr( "yY", *s ) && !s[1] )
+ return 1;
+ if( strchr( "qQ", *s ) && !s[1] )
+ return -1;
return 0;
}