From: Martin Vidner Date: Wed, 1 Nov 2006 17:49:46 +0000 (+0000) Subject: shell fix: after a question, do not leave the newline as the next X-Git-Tag: BASE-SuSE-SLE-10-SP2-Branch~66 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a94119e119797781a5fe8276e0c9e0d8904072e6;p=platform%2Fupstream%2Fzypper.git shell fix: after a question, do not leave the newline as the next input --- 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;