diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2001-10-05 21:31:29 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2001-10-05 21:31:29 (GMT) |
commit | d0aec59356d65ede1cd5b89aa5ca3481fc216684 (patch) | |
tree | aee78f4748b6f7f8f8faf066f6bd661c18b19275 /Source/cmSystemTools.cxx | |
parent | c1fa8454a1269fc35f5df0826b455d7b608182fb (diff) | |
download | CMake-d0aec59356d65ede1cd5b89aa5ca3481fc216684.zip CMake-d0aec59356d65ede1cd5b89aa5ca3481fc216684.tar.gz CMake-d0aec59356d65ede1cd5b89aa5ca3481fc216684.tar.bz2 |
ENH: clean up returns from input, so we can read dos files on unix
Diffstat (limited to 'Source/cmSystemTools.cxx')
-rw-r--r-- | Source/cmSystemTools.cxx | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index a7df5bf..5c36e69 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -484,6 +484,18 @@ const char *cmSystemTools::ConvertToWindowsSlashesAndCleanUp(std::string& path) return path.c_str(); } +inline void CleanText(char* s) +{ + while(*s != 0) + { + if(*s == '\r') + { + *s = ' '; + } + s++; + } +} + bool cmSystemTools::ParseFunction(std::ifstream& fin, std::string& name, std::vector<std::string>& arguments, @@ -497,9 +509,9 @@ bool cmSystemTools::ParseFunction(std::ifstream& fin, { return false; } - if(fin.getline(inbuffer, BUFFER_SIZE ) ) { + CleanText(&inbuffer[0]); cmRegularExpression blankLine("^[ \t]*$"); cmRegularExpression comment("^[ \t]*#.*$"); cmRegularExpression oneLiner("^[ \t]*([A-Za-z_0-9]*)[ \t]*\\((.*)\\)[ \t]*$"); @@ -534,6 +546,7 @@ bool cmSystemTools::ParseFunction(std::ifstream& fin, // read lines until the end paren is found if(fin.getline(inbuffer, BUFFER_SIZE ) ) { + CleanText(&inbuffer[0]); // Check for comment lines and ignore them. if(blankLine.find(inbuffer) || comment.find(inbuffer)) { continue; } |