9 if($ENV{'FCGI_ROLE'}) {
10 print "Content-Type: text/plain\r\n\r\n";
15 'o|output=s' => \
$output,
16 'f|file=s' => \
$nginx_conf,
18 or die "Usage: $0 [-f config_file] [-o <plain|dot|merge>]\n";
24 open $fh, '-|', "nginx -V 2>&1";
28 /--conf-path=(\S+)/ and $nginx_conf = $1 or die "No '--conf-path' compile option found for nginx.\n";
31 ($nginx_conf_root) = ($nginx_conf =~ /^(.*)\/+[^\
/]+$/);
39 $filespec = "$nginx_conf_root/$filespec" if $filespec !~ /^\
//;
41 for my $file (glob $filespec) {
42 my ($rel_file) = $file;
43 $rel_file =~ s/^\Q$nginx_conf_root\E\/+//;
45 if($output eq "plain") {
46 printf "%s%s\n", " "x
$indent, $rel_file;
48 if($output eq "dot" and $caller) {
49 printf "\"%s\" -> \"%s\";\n", $caller, $rel_file;
52 open my $fh, '<', $file or warn "$file: $!\n";
56 if($output eq "merge") {
57 print "\n#!", "#" x
$indent, " file: $file\n";
61 if($conf =~ /(^|;)\s*include\s+(\S+?)\s*;/sm) {
62 if($output eq "merge") {
68 readconffile($child, $indent+1, $rel_file);
71 if($output eq "merge") {
78 if($output eq "merge") {
79 print "\n#!", "#" x $indent, " end of file: $file\n";
84 if($output eq "dot") {
92 readconffile($nginx_conf, 0);
94 if($output eq "dot") {