aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
Diffstat (limited to 'util')
-rw-r--r--util/ChangeLog4
-rw-r--r--util/miscutil.c23
2 files changed, 27 insertions, 0 deletions
diff --git a/util/ChangeLog b/util/ChangeLog
index 0ec6deb40..bf0ebb5f9 100644
--- a/util/ChangeLog
+++ b/util/ChangeLog
@@ -1,3 +1,7 @@
+Thu May 27 09:40:55 CEST 1999 Werner Koch <[email protected]>
+
+ * miscutil.c (answer_is_yes_no_quit): New.
+
Sun May 23 14:20:22 CEST 1999 Werner Koch <[email protected]>
* dotlock.c: Tweaked to make it compile under mingw32
diff --git a/util/miscutil.c b/util/miscutil.c
index d902ae435..d982e64af 100644
--- a/util/miscutil.c
+++ b/util/miscutil.c
@@ -164,3 +164,26 @@ answer_is_yes( const char *s )
}
+/****************
+ * Return 1 for yes, -1 for quit, or 0 for no
+ */
+int
+answer_is_yes_no_quit( const char *s )
+{
+ char *long_yes = _("yes");
+ char *long_quit = _("quit");
+ char *short_yes = _("yY");
+ char *short_quit = _("qQ");
+
+ if( !stricmp(s, long_yes ) )
+ return 1;
+ if( !stricmp(s, long_quit ) )
+ return -1;
+ if( strchr( short_yes, *s ) && !s[1] )
+ return 1;
+ if( strchr( short_quit, *s ) && !s[1] )
+ return -1;
+ return 0;
+}
+
+