From: Bert Hubert Date: Sun, 20 Jul 2008 18:39:38 +0000 (+0000) Subject: remove use of possibly buggy 'chomp' from arguments.cc and move to trim_right().... X-Git-Tag: rec-3.2~285 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5b2cb3be10f33854350b4c3649ae8de49d87d8cc;p=pdns remove use of possibly buggy 'chomp' from arguments.cc and move to trim_right(). Solves issue reported by Tyler Hall git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@1237 d19b8d6e-7fed-0310-83ef-9ca221ded41b --- diff --git a/pdns/arguments.cc b/pdns/arguments.cc index 1178b3eb1..f67f67116 100644 --- a/pdns/arguments.cc +++ b/pdns/arguments.cc @@ -1,6 +1,6 @@ /* PowerDNS Versatile Database Driven Nameserver - Copyright (C) 2002 - 2006 PowerDNS.COM BV + Copyright (C) 2002 - 2008 PowerDNS.COM BV This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published @@ -15,10 +15,9 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - - - #include "arguments.hh" +#include +using namespace boost; const ArgvMap::param_t::const_iterator ArgvMap::begin() { @@ -259,8 +258,8 @@ bool ArgvMap::preParseFile(const char *fname, const string &arg) string::size_type pos; while(getline(f,pline)) { - chomp(pline," \t\r\n"); // strip trailing white spaces - + trim_right(pline); + if(pline[pline.size()-1]=='\\') { line+=pline.substr(0,pline.length()-1); continue; @@ -273,7 +272,7 @@ bool ArgvMap::preParseFile(const char *fname, const string &arg) line=line.substr(0,pos); // strip trailing spaces - chomp(line," \t"); + trim_right(line); // strip leading spaces if((pos=line.find_first_not_of(" \t\r\n"))!=string::npos) @@ -301,7 +300,7 @@ bool ArgvMap::file(const char *fname, bool lax) string::size_type pos; while(getline(f,pline)) { - chomp(pline," \t\r\n"); // strip trailing white spaces + trim_right(pline); if(pline.empty()) continue; @@ -318,8 +317,7 @@ bool ArgvMap::file(const char *fname, bool lax) line=line.substr(0,pos); // strip trailing spaces - chomp(line," \t"); - + trim_right(line); // strip leading spaces if((pos=line.find_first_not_of(" \t\r\n"))!=string::npos) line=line.substr(pos);