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
This commit is contained in:
prozacx
2006-09-16 01:54:13 +00:00
parent 0f85fee9e6
commit ee620347c5

View File

@@ -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();