summaryrefslogtreecommitdiffstats
path: root/Source/kwsys/SystemTools.cxx
diff options
context:
space:
mode:
authorAndy Cedilnik <andy.cedilnik@kitware.com>2003-07-07 21:45:51 (GMT)
committerAndy Cedilnik <andy.cedilnik@kitware.com>2003-07-07 21:45:51 (GMT)
commit197368d9e7890cf4bcb36d40cb15413a8209aaca (patch)
treea1afe04481e0c979922c8df1b6f5ffa020f94a66 /Source/kwsys/SystemTools.cxx
parent42731475dc18a0112cff8974352c7b622e87555d (diff)
downloadCMake-197368d9e7890cf4bcb36d40cb15413a8209aaca.zip
CMake-197368d9e7890cf4bcb36d40cb15413a8209aaca.tar.gz
CMake-197368d9e7890cf4bcb36d40cb15413a8209aaca.tar.bz2
ENH: Add optional argument to GetLineFromStream which can let the caller know whether there was a new line character at the end of the line that was just read
Diffstat (limited to 'Source/kwsys/SystemTools.cxx')
-rw-r--r--Source/kwsys/SystemTools.cxx11
1 files changed, 10 insertions, 1 deletions
diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx
index 038d2fa..04009a3 100644
--- a/Source/kwsys/SystemTools.cxx
+++ b/Source/kwsys/SystemTools.cxx
@@ -1616,12 +1616,17 @@ kwsys_std::string SystemTools::MakeCindentifier(const char* s)
// Due to a buggy stream library on the HP and another on Mac OSX, we
// need this very carefully written version of getline. Returns true
// if any data were read before the end-of-file was reached.
-bool SystemTools::GetLineFromStream(kwsys_std::istream& is, kwsys_std::string& line)
+bool SystemTools::GetLineFromStream(kwsys_std::istream& is, kwsys_std::string& line,
+ bool *has_newline /* = 0 */)
{
const int bufferSize = 1024;
char buffer[bufferSize];
line = "";
bool haveData = false;
+ if ( has_newline )
+ {
+ *has_newline = false;
+ }
// If no characters are read from the stream, the end of file has
// been reached.
@@ -1635,6 +1640,10 @@ bool SystemTools::GetLineFromStream(kwsys_std::istream& is, kwsys_std::string& l
// reached.
if(strlen(buffer) < static_cast<size_t>(is.gcount()))
{
+ if ( has_newline )
+ {
+ *has_newline = true;
+ }
break;
}