#!/usr/bin/perl

$filename = $ARGV[0];

if (-e $filename) {
  $HTML = `cat "$filename"`;
}
else {
  $HTML = "<html>\n<head>\n<title>Changelog "
	. `date`
	. "</title>\n"
	. "<style type=\"text/css\">\n"
	. "body { font-family: arial, helvetica; font-size: 10pt }"
	. "</style>"
	. "</head>\n<body>\n"
	. "</body>\n</html>\n";
}

$HTMLOUT = "<h1>Source File section</h1>\n";

$FILE = `cat DIFF-OUT`;
foreach $entry ( split /\n/, $FILE ) {
  $entry =~ /File ([^:]*): (.*)/;
  $action = $1;
  $str = $2;
  if ($action eq "created") {
    $HTMLOUT .= "File created: $str</br>\n";
  }
  elsif ($action eq "deleted") {
    $HTMLOUT .= "File deleted: $str</br>\n";
  }
  else {
    die "Unkown action $action\n";
  }
}

$HTML =~ s/<body>\n/<body>\n$HTMLOUT/;

print $HTML;
