]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - .inspircd.inc
Add names for all modes (part 1 of named channel mode list)
[user/henk/code/inspircd.git] / .inspircd.inc
index f419d4b8a60ec87ab59a141cbd4b44d0e3d304b3..91a06ccfd6430f849f13abb93f05fcd5eb749851 100644 (file)
@@ -18,7 +18,6 @@ use Fcntl;
 my $basepath   =       "@BASE_DIR@";
 my $confpath   =       "@CONFIG_DIR@/";
 my $binpath    =       "@BINARY_DIR@";
-my $libpath    =       "@LIBRARY_DIR@";
 my $valgrindlogpath    =       "$basepath/valgrindlogs";
 my $executable =       "@EXECUTABLE@";
 my $version    =       "@VERSION@";
@@ -26,7 +25,7 @@ my $version   =       "@VERSION@";
 our($pid,$pidfile);
 # Lets see what they want to do.. Set the variable (Cause i'm a lazy coder)
 my $arg = shift(@ARGV);
-my $conf = $confpath . "inspircd.conf";
+my $conf;
 for my $a (@ARGV)
 {
        if ($a =~ m/^--config=(.*)$/)
@@ -35,6 +34,11 @@ for my $a (@ARGV)
                last;
        }
 }
+if (!defined $conf) {
+       $conf = $confpath . "inspircd.conf";
+       push @ARGV, '--config='.$conf;
+}
+
 getpidfile($conf);
 
 # System for naming script command subs:
@@ -316,10 +320,23 @@ sub getpidfile
                {
                        # Set the PID file and return.
                        $pidfile = $1;
+                       if (-f $pidfile)
+                       {
+                               return;
+                       }
+                       else
+                       {
+                               if (-f $confpath . $pidfile)
+                               {
+                                       $pidfile = $confpath . $pidfile;
+                                       return;
+                               }
+                       }
                        return;
                }
        }
 
+
        # If we get here, NO PID FILE! -- Check for includes
        for my $i (@lines) {
                $i =~ s/[^=]+=\s(.*)/\1/;
@@ -328,6 +345,18 @@ sub getpidfile
                        # Decend into that file, and check for PIDs.. (that sounds like an STD ;/)
                        getpidfile($1);
                        # Was a PID found?
+                       if (-f $pidfile)
+                       {
+                               return;
+                       }
+                       else
+                       {
+                               if (-f $confpath . $pidfile)
+                               {
+                                       $pidfile = $confpath . $pidfile;
+                                       return;
+                               }
+                       }
                        if ($pidfile ne "") {
                                # Yes, Return.
                                return;