#!/usr/bin/env perl
#
# Generate indexes for html documentation
#
use strict;
use warnings;
use Getopt::Long;
use IO::File;
use File::Basename;
Getopt::Long::Configure('bundling');
@ARGV >= 2 or die;
our @docs;
our @dirs;
our %index;
our $outdir;
our $debug;
GetOptions("i=s" => sub { read_index(@_);},
"D" => \$debug)
or die;
($outdir,@docs) = @ARGV;
sub write_file ($$) {
my ($opath, $odata) = @_;
print STDOUT "Writing: $opath\n";
my $out = new IO::File "$opath.new", '>' or die "$opath $!";
print $out $odata or die $!;
rename "$opath.new", "$opath" or die "$opath $!";
}
sub make_page ($$$) {
my ($file,$title,$content) = @_;
my $o = '';
my $h1;
if ( $title eq "" )
{
$title = $h1 = "Xen Documentation";
}
else
{
$h1 = "Xen Documentation - $title";
$title = "Xen Documentation - $title";
}
$o .= <$title
$h1