]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - .inspircd.inc
Consistancy: Allow opers to +L to a nonexistant channel, as we allow opers to bypass...
[user/henk/code/inspircd.git] / .inspircd.inc
index f03595b42b7e0ab9cfa75756a0fe662a6e7f876a..37d23b8c5eab7c800e0e7d515ec0996c9367eb3f 100644 (file)
@@ -3,16 +3,13 @@
 #       | Inspire Internet Relay Chat Daemon |
 #       +------------------------------------+
 #
-#  Inspire is copyright (C) 2002-2004 ChatSpike-Dev.
-#                       E-mail:
-#                <brain@chatspike.net>
-#                <Craig@chatspike.net>
+#      (C) 2002-2008 InspIRCd Development Team
+#   http://www.inspircd.org/wiki/index.php/Credits
 #
 # Written by Craig Edwards, Craig McLure, and others.
 # This program is free but copyrighted software; see
 #            the file COPYING for details.
 #
-#               I HATE PERL.. kthxbye
 # ---------------------------------------------------
 use POSIX;
 
@@ -91,6 +88,7 @@ if ($arg eq "Cheese-Sandwich") {
 ###
 print "Invalid Argument: $arg\n";
 print "Usage: inspircd (start|stop|restart|rehash|status|cron|checkconf|version)\n";
+print "Developer arguments: (debug|screendebug|valdebug|screenvaldebug)\n";
 exit();
 
 ###
@@ -102,6 +100,7 @@ sub start {
        if (getstatus() == 1) { print "InspIRCd is already running.\n"; return 0; }
        # If we are still alive here.. Try starting the IRCd..
        print "$binpath/$executable doesn't exist\n" and return 0 unless(-e "$binpath/$executable");
+       print "$binpath/$executable is not executable\n" and return 0 unless(-f "$binpath/$executable" && -x "$binpath/$executable");
 
        system("$binpath/$executable");
        return 1;
@@ -112,12 +111,13 @@ sub debug {
        if (getstatus() == 1) { print "InspIRCd is already running.\n"; return 0; }
 
        print "$binpath/$executable doesn't exist\n" and return 0 unless(-e "$binpath/$executable");
+       print "$binpath/$executable is not executable\n" and return 0 unless(-f "$binpath/$executable" && -x "$binpath/$executable");
 
        # Check we have gdb
        checkgdb();
 
        # If we are still alive here.. Try starting the IRCd..
-       system("gdb --command=$basepath/.gdbargs --args $binpath/$executable -nofork -debug -nolog");
+       system("gdb --command=$basepath/.gdbargs --args $binpath/$executable -nofork -debug");
 }
 
 sub screendebug
@@ -143,6 +143,7 @@ sub valdebug
        if (getstatus() == 1) { print "InspIRCd is already running.\n"; return 0; }
 
        print "$binpath/$executable doesn't exist\n" and return 0 unless(-e "$binpath/$executable");
+       print "$binpath/$executable is not executable\n" and return 0 unless(-f "$binpath/$executable" && -x "$binpath/$executable");
 
        # Check we have valgrind and gdb
        checkvalgrind();
@@ -160,6 +161,7 @@ sub screenvaldebug
        if (getstatus() == 1) { print "InspIRCd is already running.\n"; return 0; }
 
        print "$binpath/$executable doesn't exist\n" and return 0 unless(-e "$binpath/$executable");
+       print "$binpath/$executable is not executable\n" and return 0 unless(-f "$binpath/$executable" && -x "$binpath/$executable");
 
        #Check we have gdb
        checkvalgrind();
@@ -361,13 +363,11 @@ sub validateconf
 #       push @newlines, "<!DOCTYPE config SYSTEM \"".$confpath."inspircd.dtd\">";
        push @newlines, "<config>";
 
-       foreach $i (@lines) {
+       foreach $i (@lines)
+       {
                # remove trailing newlines
                chomp($i);
 
-               # clean up
-               $i =~ s/[^=]+=\s(.*)/\1/;
-
                # convert tabs to spaces
                $i =~ s/\t/ /g;
 
@@ -380,11 +380,25 @@ 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/ *$//;
 
+               # setup incf for include check and clean it up, since this breaks parsing use local var
+               my $incf = $i;
+               $incf =~ s/[^=]+=\s(.*)/\1/;
+
                # include file?
-               if (($i =~ s/\<include file=\"(.+?)\"\>//i) && ($i !~ /^#/))
+               if (($incf =~ s/\<include file=\"(.+?)\"\>//i) && ($incf !~ /^#/))
                {
                        # yes, process it
                        validateconf($1);