diff options
Diffstat (limited to 'sitemap.buetow.org/content/sitemap.inc.pl')
| -rw-r--r-- | sitemap.buetow.org/content/sitemap.inc.pl | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/sitemap.buetow.org/content/sitemap.inc.pl b/sitemap.buetow.org/content/sitemap.inc.pl new file mode 100644 index 0000000..37740e7 --- /dev/null +++ b/sitemap.buetow.org/content/sitemap.inc.pl @@ -0,0 +1,36 @@ +my $hostroot = $config->get_hostroot(); + +sub getf ($) { + open my $f, $_[0] or die "$!: $_[0]\n"; + my @slurp = <$f>; + close $f; + @slurp; +} + +sub nl () { "<br />\n" } + +sub list (*) { + my $tag = shift; + my @found = sort `find $hostroot -name $tag`; + my $ret = ''; + + + for my $found (@found) { + $found =~ /.*hosts.(.*?).$tag/; + my $host = $1; + + my @content = getf $found; + + $ret .= "<b><a href=http://$host>$host</a></b>" . nl;; + + if (@content) { + $ret .= join " ", @content; + $ret .= nl; + } + $ret .= nl; + } + + $ret; +} + +list SITEMAP; |
