#!/usr/bin/perl -w # # This is John Chambers' CGI script to take the output of the # saying command and deliver it as a web page. Look for the # Sayings file for the data used by these programs. $| = 1; ($P = $0) =~ s".*/""; $V = $ENV{"V_$P"} || 3; $inHTML = 1; print "Content-type: text/html; charset=utf-8\n\n"; print "
\n"; print "\n";
$cmd .= " $n";
}
loop:
while ($looping) {
@txt = `$cmd`;
print "Cookie $looping:
\n" if $V>1;
for $line (@txt) {
$line =~ s/[\s\r]+$//;
print "
Line: \"$line\"
\n" if $V>1;
($pfx,$msg) = ($line =~ /^(\|*) ?(.*)$/);
if ($pfx eq '|') { # HTML?
#
} else { # Plain text.
if ($inPRE) { # We're in a
section print ""; $inHTML = 1; $inPRE = 0; } elsif ($inPRE = $inHTML) { print "
"; $inHTML = 0; } } if ($inHTML) { # $msg =~ s/^\s*//; $msg = ""; $inHTML = 1; $inPRE = 0; } if (--$looping > 0) { print "" unless $msg; } print "\t$msg\n"; } if ($inPRE) { print "
\n"; sleep 10; } } print "\n"; exit 0;