#!/usr/bin/perl

# Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Simon Josefsson.
#
# This file is part of Autobuild.
#
# Autobuild is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Autobuild is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Autobuild.  If not, see <http://www.gnu.org/licenses/>.

use strict;
use Getopt::Long;

# Parse command line parameters.
my $Verbose;
my ($PrintHelp, $PrintVersion);
my ($Abort, $DryRun, $SkipUnknown);
my ($Project, $Revision, $Mode, $Hostname, $Hosttype,
    $Buildtype, $Timestamp, $Status, $IgnoreFiles, $InlineHTML);
GetOptions ('help|usage|h'   => \$PrintHelp,
	    'version'        => \$PrintVersion,
	    'verbose|v'      => \$Verbose,
	    'abort|a'        => \$Abort,
	    'dry-run|n'      => \$DryRun,
	    'skip-unknown|s' => \$SkipUnknown,
	    'p|project=s'    => \$Project,
	    'revision=s'     => \$Revision,
	    'mode=s'         => \$Mode,
	    'Hosttype=s'     => \$Hosttype,
	    'Buildtype=s'    => \$Buildtype,
	    'Hostname=s'     => \$Hostname,
	    'Timestamp=s'    => \$Timestamp,
	    'Status=s'       => \$Status,
	    'Ignore-files=s' => \$IgnoreFiles,
	    'inline-html=i'  => \$InlineHTML);

# Handle --verison.
if ($PrintVersion) {
    print "autobuild (Autobuild) 5.3\n";
    print "Copyright (C) 2004, 2005, 2007, 2008, 2009, 2010 Simon Josefsson\n";
    print "License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\n";
    print "This is free software: you are free to change and redistribute it.\n";
    print "There is NO WARRANTY, to the extent permitted by law.\n";
    print "\n";
    print "Written by Simon Josefsson.\n";
    exit 0;
}

# Handle --help.
if ($PrintHelp || (!$PrintVersion && $#ARGV == -1)) {
    print "Usage: $0 [OPTION]... FILE...\n";
    print "\n";
    print "Read and parse build logs to find project name, revision, build mode,\n";
    print "build host type, build type (for cross compile builds), hostname, and\n";
    print "timestamp, then print a HTML page with information and links to the logs.\n";
    print "\n";
    print "Mandatory arguments to long options are mandatory for short options too.\n";
    print "\n";
    print "      --abort             Abort if any of the following values\n";
    print "                          cannot be guessed: project name, revision,\n";
    print "                          host type, and build type.\n";
    print "  -n, --dry-run           Just parse, don't print output.\n";
    print "  -s, --skip-unknown      Skip unparsable files.\n";
    print "  -v, --verbose           Explain what is being done.\n";
    print "  -i, --inline-html       Skip standard HTML header and footer.\n";
    print "      --ignore-files=STR  Skip filenames matching regexp STR.\n";
    print "\n";
    print "For use when autobuild fail to guess the values properly:\n";
    print "\n";
    print "  -p, --project=STRING    Specify project name.\n";
    print "      --revision=STRING   Specify project revision.\n";
    print "      --mode=STRING       Specify build mode (typically 'default').\n";
    print "      --hosttype=STRING   Specify host type (e.g., i686-pc-linux-gnu).\n";
    print "      --buildtype=STRING  Specify build type (e.g., m68k-uclinux-elf).\n";
    print "                          Different from hosttype for cross compiles.\n";
    print "      --hostname=STRING   Specify name of host log was created on.\n";
    print "      --timestamp=STRING  Specify when build was made.\n";
    print "                          Any date format will work, but\n";
    print "                          'YYYY-MM-DDTHH:MM:SS' is recommended.\n";
    print "      --status=STRING     Outcome of build.\n";
    print "                          Any string will work, but \"ok\" and\n";
    print "                          \"fail\" are recommended for the two\n";
    print "                          basic outcomes.\n";
    print "\n";
    print "Other options:\n";
    print "\n";
    print "      --help              Display this help and exit.\n";
    print "      --version           Output version information and exit.\n";
    print "\n";
    print "Report bugs to <bug-autobuild\@josefsson.org>.\n";
    exit 0;
}

# Core.

my (@Files, $arg, $file);

my (%Project);
my (%Revision);
my (%Mode);
my (%Hosttype);
my (%Buildtype);
my (%Hostname);
my (%Timestamp);
my (%Status);

my (%Projects);
my (%Revisions);
my (%Hosttypes);
my (%Hostnames);

foreach $arg (@ARGV) {
    my (@files);

    if (-d $arg) {
	if (!opendir DIRH, $arg) {
	    warn "Cannot open directory: $arg";
	    next;
	}
	@files =
	    grep { (!$IgnoreFiles || !/$IgnoreFiles/)
		       && /^[^.]/ && -f "$arg/$_" } readdir(DIRH);
	closedir DIRH;
    } elsif (-f $arg) {
	push @files, $arg;
    } else {
	warn "Skipping unknown file type: $arg";
	next;
    }

    foreach $file (@files) {
	my ($project, $revision, $mode, $hostname, $hosttype,
	    $buildtype, $timestamp, $status);

	# Initialize variables.
	$project = $Project;
	$revision = $Revision;
	$mode = $Mode;
	$hostname = $Hostname;
	$hosttype = $Hosttype;
	$buildtype = $Buildtype;
	$timestamp = $Timestamp;

	open FH, $file or die "Cannot open file: $file";

	while (<FH>) {
	    if (m,\r\n$,) {
		chop; chop;
		$_ = $_ . "\n";
	    }

	    # These override everything (except command line parameters).
	    $project = $1 if !$Project && m,autobuild project... (.+),;
	    $revision = $1 if !$Revision && m,autobuild revision... (.+),;
	    $mode = $1 if !$Mode && m,autobuild mode... (.+),;
	    $hostname = $1 if !$Hostname && m,autobuild hostname... (.+),;
	    $hosttype = $1 if !$Hosttype && m,autobuild hosttype... (.+),;
	    $buildtype = $1 if !$Buildtype && m,autobuild buildtype... (.+),;
	    $timestamp = $1 if !$Timestamp && m,autobuild timestamp... (.+),;

	    # GNU Autoconf host/build output.
	    $hosttype = $3 if !$hosttype && m,host system type(<[^>]+>)?\.\.\. (<[^>]+>)?([a-z0-9_.-]+),;
	    $buildtype = $3 if !$buildtype && m,build system type(<[^>]+>)?\.\.\. (<[^>]+>)?([a-z0-9_.-]+),;

	    # Automake self test or distcheck output.
	    $status = "ok" if !$status && m,All \d+ tests passed,;
	    $status = "ok" if !$status && m,1 test passed,;
	    $status = "almost" if m,\d+ of \d+ tests failed,;

	    # libcheck self tests.
	    $status = "almost" if !$status && m,Errors: [1-9]+,;
	    $status = "almost" if!$status &&  m,Failures: [1-9]+,;

	    # Dejagnu self tests.
	    $status = "ok" if !$status && m,^# of expected ,;
	    $status = "almost" if m,# of unexpected ,;

	    # Old (?) automake output.
	    $status = "built" if !$status && m,archives ready for distribution,;

	    # Works for GNU make.
	    $project = $2 if !$project && m,Entering directory `(<[^>]+>)?.*/([a-z-]+)-[0-9.a-z-]+/.*(<[^>]+>)?',;
	    $revision = $2 if !$revision && m,Entering directory `(<[^>]+>)?.*/[a-z-]+-([0-9.a-z-]+)/.*(<[^>]+>)?',;

	    # Telnet string.
	    $hostname = $1 if !$hostname && m,Trying (.*)\.\.\.,;
	    $hostname = $1 if !$hostname && m,Connected to (.*)\.,;

	    # SSH string.
	    $hostname = $1 if !$hostname && m,Connection to (.*) closed.,;

	    # If output mention a tar.gz archive.
	    $project = $1 if !$project && m,/([a-z-]+)-[0-9.a-z-]+.tar.gz,;
	    $revision = $1 if !$revision && m,/[a-z-]+-([0-9.a-z-]+).tar.gz,;

	    # If you invoke set standing in the directory of the project...
	    # Happens to work for 'abbuild-sourceforge', but looks error prone.
	    $project = $2 if !$project && m,PWD=(<[^>]+>)?.*/([a-z0-9-]+)-[0-9.a-z-]+,;
	    $revision = $2 if !$revision && m,PWD=(<[^>]+>)?.*/[a-z0-9-]+-([0-9.a-z-]+),;

	    # Errors from tar...
	    $project = $2 if !$project && m,tar(<[^>]+>)?: ([a-z0-9-]+)-[0-9.a-z-]+/,;
	    $revision = $2 if !$revision && m,tar(<[^>]+>)?: [a-z0-9-]+-([0-9.a-z-]+)/,;

	    # File name .../*.tar.gz...
	    $project = $1 if !$project && m,/([a-z0-9-]+)-[0-9.a-z-]+.tar.gz,;
	    $revision = $1 if !$revision && m,/[a-z0-9-]+-([0-9.a-z-]+).tar.gz,;

	    # Errors from AIX make.
	    $status = "fail" if m,^make:.*The error code from the last command is \d+,;
	    # Errors from IRIX make.
	    $status = "fail" if m,^\*\*\* Error code \d+,;
	}

	close FH;

	if (!$Abort) {
	    $project = "unknown" if !$project;
	    $revision = "0" if !$revision || $revision eq "";
	    $hosttype = "unknown" if !$hosttype;
	    $buildtype = "unknown" if !$buildtype;
	}
	$hostname = "unknown" if !$hostname;
	$mode = "default" if !$mode;
	$status = "fail" if !$status;
	$timestamp = "unknown" if !$timestamp;

	if ($Verbose) {
	    print STDERR "`$file':\n";
	    print STDERR " Project: $project\n";
	    print STDERR " Revision: $revision\n";
	    print STDERR " Mode: $mode\n";
	    print STDERR " Hosttype: $hosttype\n";
	    print STDERR " Buildtype: $buildtype\n";
	    print STDERR " Hostname: $hostname\n";
	    print STDERR " Timestamp: $timestamp\n";
	    print STDERR " Status: $status\n";
	}

	die "Could not guess all required values" .
	    ($Verbose ? " for file\n" :
	     " (use -v to print values) while reading:\n$file\n")
	    if $Abort && (!$project || $revision eq "" ||
			  !$hosttype || !$buildtype || !$status);

	push @Files, $file;

	$Project{$file} = $project;
	$Revision{$file} = $revision;
	$Mode{$file} = $mode;
	$Hostname{$file} = $hostname;
	$Hosttype{$file} = $hosttype;
	$Buildtype{$file} = $buildtype;
	$Timestamp{$file} = $timestamp;
	$Status{$file} = $status;

	$Projects{$project} = 0;
	${$Revisions{$project}}{$revision} = 0;
	${$Hosttypes{$project}}{$hosttype} = 0;
	${$Hostnames{$project}}{$hostname} = 0;
    }
}

exit 0 if $DryRun;

delete $Projects{"unknown"} if $SkipUnknown;

my ($project, $revision, $hosttype, $hostname);

if (!$InlineHTML) {
    print "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
    print "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n";
    print "          \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n";
    print "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\">\n";
    print "<head>\n";
    print "  <title>Autobuild log summary</title>\n";
    print "</head>\n";
    print "<body>\n";
}

{
    print "<h1>Summary</h1>\n";
    print "\n";
    print "<table border=\"0\">\n";
    print "<tr bgcolor=\"lightblue\">\n";
    print "<td>Project</td>\n";
    print "<td>Build type</td>\n";
    print "<td>Revision</td>\n";
    print "<td>System</td>\n";
    print "<td>Build date</td>\n";
    print "<td>Results</td>\n";
    print "</tr>\n\n";
    my $bit = 0;
    foreach $project (sort keys %Projects) {
	my $first = 1;

	if ($bit) {
	    print "<tr bgcolor=\"lightgrey\">\n";
	} else {
	    print "<tr>\n";
	}
	$bit = !$bit;

	print "<td><a href=\"#$project\">$project</a></td>\n";

	foreach $hosttype (sort keys %{$Hosttypes{$project}}) {
	    my %DoneType;

	    if ($first) {
		print "<td><a href=\"#$project-$hosttype\">$hosttype</a>";
	    } else {
		if ($bit) {
		    print "<tr bgcolor=\"lightgrey\">\n";
		} else {
		    print "<tr>\n";
		}
		print "<td></td>\n";
		print "<td><a href=\"#$project-$hosttype\">$hosttype</a>";
		$bit = !$bit;
	    }
	    $first = 0;

	    foreach $file (reverse sort @Files) {
		next unless $Project{$file} eq $project;
		next unless $Hosttype{$file} eq $hosttype;
		next unless !$DoneType{$hosttype};
		$DoneType{$hosttype} = 1;

		my ($Project);
		my ($Revision);
		my ($Mode);
		my ($Hosttype);
		my ($Buildtype);
		my ($Hostname);
		my ($Timestamp);
		my ($Status);

		$Revision = $Revision{$file};
		$Mode = $Mode{$file};
		$Hostname = $Hostname{$file};
		$Buildtype = $Buildtype{$file};
		$Timestamp = $Timestamp{$file};
		$Status = $Status{$file};

		if ($hosttype eq $Buildtype) {
		    print "</td>\n";
		} else {
		    print " from $Buildtype</td>\n";
		}
		print "<td><a href=\"#$project-$Revision\">$Revision</a></td>\n";
		print "<td><a href=\"#$project-$Hostname\">$Hostname</a></td>\n";
		print "<td>$Timestamp</td>\n";
		print "<td><a href=\"$file\">\n";
		if ($Status eq "ok") {
		    print "<font color=\"green\">Success</font>\n";
		} elsif ($Status eq "almost") {
		    print "<font color=\"orange\">Almost</font>\n";
		} elsif ($Status eq "built") {
		    print "<font color=\"yellow\">Built</font>\n";
		} else {
		    print "<font color=\"red\">Failure</font>\n";
		}
		print "</a></td>\n";
		print "</tr>";
		print "\n";
	    }
	    print "\n";
	}
    }
    print "</table>\n";
}

foreach $project (sort keys %Projects) {
    print "<hr />\n";
    print "<h2><a name=\"$project\">Project '$project'</a></h2>\n";
    print "\n";
    print "<p>Revisions (" . keys(%{$Revisions{$project}}) . "): ";
    foreach $revision (reverse sort { if ($a eq $b) { return 0; } else { my $i = 0; do { my $j = substr ($a, $i, 1); my $k = substr ($b, $i, 1); if ($j != $k) { $j = substr ($a, $i); $k = substr ($b, $i); return $j <=> $k; } $i++; } while ($i < length($a)); } } keys %{$Revisions{$project}}) {
	print "<a href=\"#$project-$revision\">$revision</a>, ";
    }
    print "</p>\n";
    print "<p>Hosttypes (" . keys(%{$Hosttypes{$project}}) . "): ";
    foreach $hosttype (sort keys %{$Hosttypes{$project}}) {
	print "<a href=\"#$project-$hosttype\">$hosttype</a>, \n";
    }
    print "</p>\n";
    print "<p>Build hosts (" . keys(%{$Hostnames{$project}}) . "): ";
    foreach $hostname (sort keys %{$Hostnames{$project}}) {
	print "<a href=\"#$project-$hostname\">$hostname</a>, \n";
    }
    print "</p>\n";

    foreach $revision (reverse sort { if ($a eq $b) { return 0; } else { my $i = 0; do { my $j = substr ($a, $i, 1); my $k = substr ($b, $i, 1); if ($j != $k) { $j = substr ($a, $i); $k = substr ($b, $i); return $j <=> $k; } $i++; } while ($i < length($a)); } } keys %{$Revisions{$project}}) {
	my $bit = 0;

	print "<hr />\n";
	print "<h3><a name=\"$project-$revision\">\n";
	print "Summary for $project $revision</a></h3>\n";
	print "\n";
	print "<table border=\"0\">\n";
	print "<tr bgcolor=\"lightblue\">\n";
	print "<td>System</td>\n";
	print "<td>Build host</td>\n";
	print "<td>Build date</td>\n";
	print "<td>Results</td>\n";
	print "</tr>\n";
	print "\n";
	foreach $file (@Files) {
	    next unless $Project{$file} eq $project;
	    next unless $Revision{$file} eq $revision;

	    my ($Project);
	    my ($Revision);
	    my ($Mode);
	    my ($Hosttype);
	    my ($Buildtype);
	    my ($Hostname);
	    my ($Timestamp);
	    my ($Status);

	    $Mode = $Mode{$file};
	    $Hosttype = $Hosttype{$file};
	    $Buildtype = $Buildtype{$file};
	    $Hostname = $Hostname{$file};
	    $Timestamp = $Timestamp{$file};
	    $Status = $Status{$file};

	    if ($bit) {
		print "<tr bgcolor=\"lightgrey\">\n";
	    } else {
		print "<tr>\n";
	    }
	    $bit = !$bit;

	    print "<td>$Hosttype";
	    if ($Hosttype eq $Buildtype) {
		print "</td>\n";
	    } else {
		print " from $Buildtype</td>\n";
	    }
	    print "<td>$Hostname</td>\n";
	    print "<td>$Timestamp</td>\n";
	    print "<td><a href=\"$file\">\n";
	    if ($Status eq "ok") {
		print "<font color=\"green\">Success</font>\n";
	    } elsif ($Status eq "almost") {
		print "<font color=\"orange\">Almost</font>\n";
	    } elsif ($Status eq "built") {
		print "<font color=\"yellow\">Built</font>\n";
	    } else {
		print "<font color=\"red\">Failure</font>\n";
	    }
	    print "</a></td>\n";
	    print "</tr>\n";
	    print "\n";
	}
	print "</table>\n";
	print "\n";
    }
    print "\n";

    foreach $hosttype (sort keys %{$Hosttypes{$project}}) {
	my $bit = 0;

	print "<hr />\n";
	print "<h3><a name=\"$project-$hosttype\">\n";
	print "Summary for $project on $hosttype</a></h3>\n";
	print "\n";
	print "<table border=\"0\">\n";
	print "<tr bgcolor=\"lightblue\">\n";
	print "<td>Revision</td>\n";
	print "<td>Cross?</td>\n";
	print "<td>Build host</td>\n";
	print "<td>Build date</td>\n";
	print "<td>Results</td>\n";
	print "</tr>\n";
	print "\n";
	foreach $file (@Files) {
	    next unless $Project{$file} eq $project;
	    next unless $Hosttype{$file} eq $hosttype;

	    my ($Project);
	    my ($Revision);
	    my ($Mode);
	    my ($Hosttype);
	    my ($Buildtype);
	    my ($Hostname);
	    my ($Timestamp);
	    my ($Status);

	    $Revision = $Revision{$file};
	    $Mode = $Mode{$file};
	    $Buildtype = $Buildtype{$file};
	    $Hostname = $Hostname{$file};
	    $Timestamp = $Timestamp{$file};
	    $Status = $Status{$file};

	    if ($bit) {
		print "<tr bgcolor=\"lightgrey\">\n";
	    } else {
		print "<tr>\n";
	    }
	    $bit = !$bit;

	    print "<td>$Revision</td>\n";
	    print "<td>";
	    if ($hosttype eq $Buildtype) {
		print "no</td>\n";
	    } else {
		print "$hosttype from $Buildtype</td>\n";
	    }
	    print "<td>$Hostname</td>\n";
	    print "<td>$Timestamp</td>\n";
	    print "<td><a href=\"$file\">\n";
	    if ($Status eq "ok") {
		print "<font color=\"green\">Success</font>\n";
	    } elsif ($Status eq "almost") {
		print "<font color=\"orange\">Almost</font>\n";
	    } elsif ($Status eq "built") {
		print "<font color=\"yellow\">Built</font>\n";
	    } else {
		print "<font color=\"red\">Failure</font>\n";
	    }
	    print "</a></td>\n";
	    print "</tr>\n";
	    print "\n";
	}
	print "</table>\n";
	print "\n";
    }
    print "\n";

    foreach $hostname (sort keys %{$Hostnames{$project}}) {
	my $bit = 0;

	print "<hr />\n";
	print "<h3><a name=\"$project-$hostname\">\n";
	print "Summary for $project built on $hostname</a></h3>\n";
	print "\n";
	print "<table border=\"0\">\n";
	print "<tr bgcolor=\"lightblue\">\n";
	print "<td>Version</td>\n";
	print "<td>System</td>\n";
	print "<td>Build date</td>\n";
	print "<td>Results</td>\n";
	print "</tr>\n";
	print "\n";
	foreach $file (@Files) {
	    next unless $Project{$file} eq $project;
	    next unless $Hostname{$file} eq $hostname;

	    my ($Project);
	    my ($Revision);
	    my ($Mode);
	    my ($Hosttype);
	    my ($Buildtype);
	    my ($Hostname);
	    my ($Timestamp);
	    my ($Status);

	    $Revision = $Revision{$file};
	    $Mode = $Mode{$file};
	    $Hosttype = $Hosttype{$file};
	    $Buildtype = $Buildtype{$file};
	    $Timestamp = $Timestamp{$file};
	    $Status = $Status{$file};

	    if ($bit) {
		print "<tr bgcolor=\"lightgrey\">\n";
	    } else {
		print "<tr>\n";
	    }
	    $bit = !$bit;

	    print "<td>$Revision</td>\n";
	    print "<td>$Hosttype";
	    if ($Hosttype eq $Buildtype) {
		print "</td>\n";
	    } else {
		print " from $Buildtype</td>\n";
	    }
	    print "<td>$Timestamp</td>\n";
	    print "<td><a href=\"$file\">\n";
	    if ($Status eq "ok") {
		print "<font color=\"green\">Success</font>\n";
	    } elsif ($Status eq "almost") {
		print "<font color=\"orange\">Almost</font>\n";
	    } elsif ($Status eq "built") {
		print "<font color=\"yellow\">Built</font>\n";
	    } else {
		print "<font color=\"red\">Failure</font>\n";
	    }
	    print "</a></td>\n";
	    print "</tr>\n";
	    print "\n";
	}
	print "</table>\n";
	print "\n";
    }
    print "\n";
}

print "\n";
print "<hr />\n";
print "<p>This page was created on " . (scalar gmtime) . " UTC using <a href=\"http://josefsson.org/autobuild/\">Autobuild</a> written by Simon Josefsson.</p>\n";
print "\n";

print "<p>\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "<br />\n";
print "</p>\n";

if (!$InlineHTML) {
    print "</body>\n";
    print "</html>\n";
}
