diff --git a/scripts/mcbot.cgi b/scripts/mcbot.cgi new file mode 100755 --- /dev/null +++ b/scripts/mcbot.cgi @@ -0,0 +1,32 @@ +#!/usr/bin/perl -W + +use strict; + +my $line; +my $a; +my $b; + +print "CONTENT-TYPE: text/html\n\n"; + +print "\n\t\n\t\tFactoids\n\t\n\n"; +open(FD, "dbtool -l |") or die("Cannot open file"); + +foreach $line() { + ($a, $b) = split(/:/, $line, 2); + $a =~ s/^[\t ]+//; # skip blanks + $b =~ s/^[\t ]+//; # skip blanks + $b =~ s/[\n]+//; # for html source :) + + if ($b) { + if($b =~ /^http/ ) { + print "$a - $b
"; + } else { + print "$a - $b
"; + } + } +} + +print "\n
$a\n"; + +print "\n"; +close(FD);