]> git.ipfire.org Git - thirdparty/AWStats.git/commitdiff
Fixed: Pb with #include
authoreldy <>
Tue, 10 Dec 2002 22:31:29 +0000 (22:31 +0000)
committereldy <>
Tue, 10 Dec 2002 22:31:29 +0000 (22:31 +0000)
wwwroot/cgi-bin/awstats.pl

index 32b112ee4fd049103ad94215fa769095069fd1e1..b36a6b634f56fc702de31f136c0dadc52f5be377 100644 (file)
@@ -959,7 +959,7 @@ sub Read_Config {
        $FileConfig=$FileSuffix='';
        foreach my $dir (@PossibleConfigDir) {
                my $searchdir=$dir;
-               if ($searchdir && (!($searchdir =~ /\/$/)) && (!($searchdir =~ /\\$/)) ) { $searchdir .= "/"; }
+               if ($searchdir && $searchdir !~ /[\\\/]$/) { $searchdir .= "/"; }
                if (open(CONFIG,"$searchdir$PROG.$SiteConfig.conf"))    { $FileConfig="$searchdir$PROG.$SiteConfig.conf"; $FileSuffix=".$SiteConfig"; last; }
                if (open(CONFIG,"$searchdir$PROG.conf"))                                { $FileConfig="$searchdir$PROG.conf"; $FileSuffix=''; last; }
        }
@@ -1018,11 +1018,9 @@ sub Parse_Config {
                if ($_ =~ /^#include "([^\"]+)"/) {
                    my $includeFile = $1;
                        if ($Debug) { debug("Found an include : $includeFile",2); }
-                   # Correct relative include files
-                   if ( $includeFile !~ m|^[\\/]| ) {
-                               my $configDir = $FileConfig;
-                               if ($configDir =~ s|[\\/][^\\/]*$|/|) {   $includeFile = "$configDir$includeFile"; }
-                               else { $includeFile = "$includeFile"; }
+                   if ( $includeFile !~ /^[\\\/]/ ) {
+                           # Correct relative include files
+                               if ($FileConfig =~ /^(.*[\\\/])[^\\\/]*$/) { $includeFile = "$1$includeFile"; }
                        }
                    if ( open( CONFIG_INCLUDE, $includeFile ) ) {
                                &Parse_Config( *CONFIG_INCLUDE , $level+1, $includeFile);