From ee620347c536fd0efb802364b681bbb07fec1608 Mon Sep 17 00:00:00 2001 From: prozacx Date: Sat, 16 Sep 2006 01:54:13 +0000 Subject: [PATCH] Patched using fix_GetInput.patch by x-x git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@757 726aef4b-f618-498e-8847-2d620e286838 --- Utils.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Utils.cpp b/Utils.cpp index 01897c4d..d3409408 100644 --- a/Utils.cpp +++ b/Utils.cpp @@ -343,6 +343,7 @@ bool CUtils::GetNumInput(const CString& sPrompt, unsigned int& uRet, unsigned in bool CUtils::GetInput(const CString& sPrompt, CString& sRet, const CString& sDefault, const CString& sHint) { CString sExtra; + CString sInput; sExtra += (!sHint.empty()) ? (" (" + sHint + ")") : ""; sExtra += (!sDefault.empty()) ? (" [" + sDefault + "]") : ""; @@ -350,14 +351,16 @@ bool CUtils::GetInput(const CString& sPrompt, CString& sRet, const CString& sDef char szBuf[1024]; memset(szBuf, 0, 1024); fgets(szBuf, 1024, stdin); - sRet = szBuf; + sInput = szBuf; - if (sRet.Right(1) == "\n") { - sRet.RightChomp(); + if (sInput.Right(1) == "\n") { + sInput.RightChomp(); } - if (sRet.empty()) { + if (sInput.empty()) { sRet = sDefault; + } else { + sRet = sInput; } return !sRet.empty();