]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blobdiff - tools/check_manualpages.pl
suricata: Change midstream policy to "pass-flow"
[people/pmueller/ipfire-2.x.git] / tools / check_manualpages.pl
old mode 100644 (file)
new mode 100755 (executable)
index 8eefc63..446e946
@@ -25,18 +25,19 @@ use strict;
 # Import make.sh environment
 my $basedir = $ENV{'BASEDIR'};
 
-# Load configuration file (General::readhash isn't available yet)
+# Load configuration file (Header::_read_manualpage_hash() isn't available yet)
 my $configfile = "${basedir}/config/cfgroot/manualpages";
 my %manualpages = ();
 
 open(my $file, "<", $configfile) or die "ERROR: Can't read from file '$configfile'!\n";
 while(my $line = <$file>) {
-       $line =~ s/\R//g;
-       next unless($line =~ /=/);
+       chomp($line);
+       next if(substr($line, 0, 1) eq '#'); # Skip comments
+       next if(index($line, '=', 1) == -1); # Skip incomplete lines
 
        my($left, $value) = split(/=/, $line, 2);
-       if($left =~ /(^[A-Za-z0-9_-]+$)/) {
-               my $key = $1; # Got alphanumeric key
+       if($left =~ /^([[:alnum:]\/._-]+)$/) {
+               my $key = $1;
                $manualpages{$key} = $value;
        }
 }
@@ -55,11 +56,11 @@ if ($baseurl =~ /\/\s*$/) {
 
 # Loop trough configured manual pages
 foreach my $page (keys %manualpages) {
-       # Build absolute path and URL
-       my $cgifile = "${basedir}/html/cgi-bin/${page}.cgi";    
+       # Build absolute path (inside cgi-bin) and URL
+       my $cgifile = "${basedir}/html/cgi-bin/${page}";
        my $url = "${baseurl}/$manualpages{$page}";
-       
-       print "${page}.cgi -> '$url'\n";
+
+       print "cgi-bin/${page} -> '$url'\n";
 
        # Check CGI file exists
        if(! -f $cgifile) {
@@ -76,7 +77,7 @@ foreach my $page (keys %manualpages) {
        if($status != 200) {
                die("ERROR: Received unexpected HTTP '$status'!\n");
        }
-       
+
        print "SUCCESS: Received HTTP '$status'.\n";
 }