From 009c2131fc7498ae8097e06877bb77562c1fdfc1 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Tue, 22 Dec 2009 12:27:59 +0100 Subject: [PATCH] xbps_yesno/noyes: change the funcs to only accept "yes" or "no" (case insensitive) answers rather than the short ones. --HG-- extra : convert_revision : xtraeme%40gmail.com-20091222112759-0mnzjt3qcwp45ugn --- lib/util.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/util.c b/lib/util.c index 6af2f17e..8bceddda 100644 --- a/lib/util.c +++ b/lib/util.c @@ -473,20 +473,18 @@ question(bool preset, const char *fmt, va_list ap) vfprintf(stderr, fmt, ap); if (preset) - fprintf(stderr, " %s ", "[Y/n]"); + fprintf(stderr, " %s ", "[YES/no]"); else - fprintf(stderr, " %s ", "[y/N]"); + fprintf(stderr, " %s ", "[yes/NO]"); if (fgets(response, 32, stdin)) { (void)strtrim(response); if (strlen(response) == 0) return preset; - if ((strcasecmp(response, "y") == 0) || - (strcasecmp(response, "yes") == 0)) + if (strcasecmp(response, "yes") == 0) return true; - else if ((strcasecmp(response, "n") == 0) || - (strcasecmp(response, "no") == 0)) + else if (strcasecmp(response, "no") == 0) return false; } return false;