From 1e0d35082d4c1104ae350e1d2faa9a967851cff4 Mon Sep 17 00:00:00 2001 From: David Rose Date: Mon, 2 Jun 2003 21:52:58 +0000 Subject: [PATCH] accept MS-DOS end-of-line characters --- panda/src/chancfg/chanparse.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/panda/src/chancfg/chanparse.cxx b/panda/src/chancfg/chanparse.cxx index 6f03c943ee..85bd6fb739 100644 --- a/panda/src/chancfg/chanparse.cxx +++ b/panda/src/chancfg/chanparse.cxx @@ -23,7 +23,7 @@ const int ChanFileEOF = -1; static bool file_done; -INLINE std::string ChanReadLine(istream& is) { +std::string ChanReadLine(istream& is) { if (is.eof() || is.fail()) #ifdef BROKEN_EXCEPTIONS { @@ -43,6 +43,9 @@ INLINE std::string ChanReadLine(istream& is) { i = S.find_first_of(";"); if (i != std::string::npos) S.erase(i, std::string::npos); // remove trailing comment + i = S.find_last_not_of(" \t\f\r\n"); + if (i != std::string::npos) + S.erase(i + 1, std::string::npos); // remove trailing whitespace return S; }