diff options
author | peavey <peavey@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-02-05 18:26:59 +0000 |
---|---|---|
committer | peavey <peavey@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-02-05 18:26:59 +0000 |
commit | f631009527f3e615416f693e3a95266832a101bd (patch) | |
tree | e5d40abdc7dfe809f313b9cf2cdf5293fc496d4f /.inspircd.inc | |
parent | 07778c4625a907edb2a6aa14e31f65e527cfd8d0 (diff) |
Make checkconf handle end of line comments.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6496 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to '.inspircd.inc')
-rw-r--r-- | .inspircd.inc | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/.inspircd.inc b/.inspircd.inc index f03595b42..b474f8438 100644 --- a/.inspircd.inc +++ b/.inspircd.inc @@ -361,7 +361,8 @@ sub validateconf # push @newlines, "<!DOCTYPE config SYSTEM \"".$confpath."inspircd.dtd\">"; push @newlines, "<config>"; - foreach $i (@lines) { + foreach $i (@lines) + { # remove trailing newlines chomp($i); @@ -380,6 +381,16 @@ sub validateconf # remove trailing #s $i =~ s/(.*)#$/\1/; + # remove trailing comments + my $line = ""; + my $quote = 0; + for (my $j = 0; $j < length($i); $j++) + { + if (substr($i,$j, 1) eq '"') { $quote = ($quote) ? 0 : 1; } elsif (substr($i,$j, 1) eq "#" && !$quote) { last; } + $line .= substr($i,$j, 1); + } + $i = $line; + # remove trailing spaces $i =~ s/ *$//; |