]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Make checkconf handle end of line comments.
authorpeavey <peavey@e03df62e-2008-0410-955e-edbf42e46eb7>
Mon, 5 Feb 2007 18:26:59 +0000 (18:26 +0000)
committerpeavey <peavey@e03df62e-2008-0410-955e-edbf42e46eb7>
Mon, 5 Feb 2007 18:26:59 +0000 (18:26 +0000)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6496 e03df62e-2008-0410-955e-edbf42e46eb7

.inspircd.inc

index f03595b42b7e0ab9cfa75756a0fe662a6e7f876a..b474f8438c1e37d398ea33af96590dcde9ebf8bc 100644 (file)
@@ -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/ *$//;