From a94119e119797781a5fe8276e0c9e0d8904072e6 Mon Sep 17 00:00:00 2001 From: Martin Vidner Date: Wed, 1 Nov 2006 17:49:46 +0000 Subject: [PATCH] shell fix: after a question, do not leave the newline as the next input --- src/zmart-misc.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/zmart-misc.cc b/src/zmart-misc.cc index 98638f5..221d364 100644 --- a/src/zmart-misc.cc +++ b/src/zmart-misc.cc @@ -31,13 +31,13 @@ void cond_init_target () { bool read_bool_with_default (bool defval) { istream & stm = cin; - char c = 0; - while (stm.good () && c != 'y' && c != 'Y' && c != 'N' && c != 'n') - stm >> c ; + string c = ""; + while (stm.good () && c != "y" && c != "Y" && c != "N" && c != "n") + c = zypp::str::getline (stm, zypp::str::TRIM); - if (c == 'y' || c == 'Y') + if (c == "y" || c == "Y") return true; - else if (c == 'n' || c == 'N') + else if (c == "n" || c == "N") return false; else return defval; -- 2.7.4