From 742d06372590b63fc25d6092c038b4e414bea55e Mon Sep 17 00:00:00 2001 From: Alex Linke Date: Tue, 23 Dec 2014 08:12:11 +0100 Subject: [PATCH] Remove leading whitespace from input lines This allows to indent regular expressions in config files and thus helps to improve readability. --- CfgFileParser.cc | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/CfgFileParser.cc b/CfgFileParser.cc index a47ec00..ab2c0eb 100644 --- a/CfgFileParser.cc +++ b/CfgFileParser.cc @@ -22,6 +22,7 @@ #include #include #include +#include #include using namespace std; @@ -121,6 +122,18 @@ char* CfgFileParser::read_line() // read next line m_infile.getline(str, MAX_CFG_LINE_LENGTH); + // remove leading whitespace + while (isspace(*str)) + { + char *sp = str; + + while (*sp) + { + *sp = *(sp+1); + sp++; + } + } + // increase line counter m_line++; -- 1.7.10.4