mirror of
https://github.com/znc/znc.git
synced 2026-05-01 19:12:31 +02:00
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:
11
Utils.cpp
11
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();
|
||||
|
||||
Reference in New Issue
Block a user