summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorAndy Cedilnik <andy.cedilnik@kitware.com>2002-09-17 18:19:50 (GMT)
committerAndy Cedilnik <andy.cedilnik@kitware.com>2002-09-17 18:19:50 (GMT)
commit8491551d6a290cf9f906b0e43c47a244ab832dd8 (patch)
treeca13f2c4b5e74508911fdfa0f547c60226782c44 /Source
parenta4b076811c5d22ffe556908c925d179756c5cc6e (diff)
downloadCMake-8491551d6a290cf9f906b0e43c47a244ab832dd8.zip
CMake-8491551d6a290cf9f906b0e43c47a244ab832dd8.tar.gz
CMake-8491551d6a290cf9f906b0e43c47a244ab832dd8.tar.bz2
Strip the string that user answers
Diffstat (limited to 'Source')
-rw-r--r--Source/cmakewizard.cxx30
1 files changed, 21 insertions, 9 deletions
diff --git a/Source/cmakewizard.cxx b/Source/cmakewizard.cxx
index db86ef1..47e3b9c 100644
--- a/Source/cmakewizard.cxx
+++ b/Source/cmakewizard.cxx
@@ -39,22 +39,34 @@ void cmakewizard::AskUser(const char* key, cmCacheManager::CacheIterator& iter)
char buffer[4096];
buffer[0] = 0;
fgets(buffer, sizeof(buffer)-1, stdin);
- if(buffer[0])
+ char ch = 0;
+
+ if(strlen(buffer) > 0)
{
- std::string value = buffer;
- if(iter.GetType() == cmCacheManager::PATH ||
- iter.GetType() == cmCacheManager::FILEPATH)
+ std::string sbuffer = buffer;
+ std::string::size_type pos = sbuffer.find_last_not_of(" \n\r\t");
+ std::string value = "";
+ if ( pos != std::string::npos )
{
- cmSystemTools::ConvertToUnixSlashes(value);
+ value = sbuffer.substr(0, pos+1);
}
- if(iter.GetType() == cmCacheManager::BOOL)
+
+ if ( value.size() > 0 )
{
- if(!cmSystemTools::IsOn(value.c_str()))
+ if(iter.GetType() == cmCacheManager::PATH ||
+ iter.GetType() == cmCacheManager::FILEPATH)
+ {
+ cmSystemTools::ConvertToUnixSlashes(value);
+ }
+ if(iter.GetType() == cmCacheManager::BOOL)
{
- value = "OFF";
+ if(!cmSystemTools::IsOn(value.c_str()))
+ {
+ value = "OFF";
+ }
}
+ iter.SetValue(value.c_str());
}
- iter.SetValue(value.c_str());
}
std::cout << "\n";
}