line? my $wasdated; # was the previous line a dated entry? $myname = basename ($0, ".pl"); # Get args: my $logfile = ''; ARG: while (@ARGV) { $_ = shift @ARGV; /^-v/ and do { my $vers = version(); warn "$vers\n"; exit (0); }; /^-.*/ and do { usage ("unrecognized option: $_"); }; $logfile = $_; } # If anything is coming in via STDIN, # use it. If not, try the $logfile. if (-f STDIN || -p STDIN) { open (F, "<&STDIN"); } else { open (F, "$logfile") || die "$logfile: can't read: $!\n"; } # # Main loop. # $gotbegin = 0; $gotdated = 0; $wasdated = 0; $preformat = 0; TOP: while () { $_ = prep ($_); # section header /^BEGINNING OF LOG FOR\s+(.*)\s+==*$/ and do { if ($gotbegin == 0) { htmltop ($1); subject ($1); } else { print "
\n"; subject ($1); print "\n"; } $gotbegin++; $wasdated = 0; next TOP; }; # begin dated entry /^[0-9A-Z]/ and do { s/ /\ \ \ /g; print "\n" if $gotdated; h3 ($_); $gotdated++; $wasdated = 1; next TOP; }; # preformatted section; leave it alone except # for command line prompts "me%" and "root#". /---------S$/ and do { print "\n"; while (\n"; next TOP; }; # row of dashes. /^\s*\-\-\-\-+\s*$/ and do { print ") { $_ = prep ($_); s!^ !!; s!me\%!me%!; s!user\%!user%!; s!root#!root#!; last if /---------E$/; print "$_\n"; } print "
\n"; next TOP; }; /^$/ and do { print "\n"; next TOP; }; # let blockquote take care of indent, but keep # two spaces after periods. s!^\s*!!g; s!\. !.\ \ !g; print "$_\n"; } htmlbot(); exit (0); #--------------------------------------------------------------------- # Start a new web page, including style sheet. sub htmltop { my ($title) = @_; print <
$title EOH } #--------------------------------------------------------------------- # Finish web page. sub htmlbot { my ($title) = @_; $_ = version(); my ($name, $v) = split; my $date = arpadate(); print <
Created by $name $v $date