#!/usr/bin/perl
use strict;
my($cmd, $cmdstr, $input, $output, $arg, $TMP, $suppress);
# Make sure local scripts can run
$ENV{PATH} = $ENV{PATH} . ":.";
$suppress = 0;
# This script runs through the specified docbook source, and applies the
# commands in blocks. It also plays games with conditional
# inclusion of text...
#
#
# ... as above ...
#
# execute blocks happen as the file is read (including recursively)
# postexecute blocks happen once the entire file has been processed, and have
# default input of the processed file
# This should be fixed...
open TMP, "> builddb-$$.tmp";
process("execute", "", \*STDIN, \*TMP);
close TMP;
open TMP, "< builddb-$$.tmp";
process("postexecute", "builddb-$$.tmp", \*TMP, \*STDOUT);
close TMP;
unlink "builddb-$$.tmp";
exit;
sub process($){
my($exblock, $exfilename, $INPTR, $OUTPTR) = @_;
while(<$INPTR>){
if((/(.*)<\/slidetext>/) || (/(.*)<\/noslide>/)){
$suppress = 0;
}
elsif((/(.*)/) && ($ARGV[0] ne "jpg")){
$suppress = 1;
}
elsif((/(.*)/) && ($ARGV[0] ne "jpg")){
}
elsif(/(.*)/){
if($ARGV[0] eq "jpg"){
$suppress = 1;
}
}
elsif(/(.*)/){
}
elsif(/(.*)<\/slideinclude>/){
}
elsif((/(.*)<$exblock>(.*)<\/$exblock>(.*)/) && ($suppress == 0)){
print $OUTPTR $1;
$cmd = $2;
$_ = $cmd;
if(//){
$input = $cmd;
$input =~ s/.*//;
$input =~ s/<\/input>.*//;
}
else{
$input = "";
}
if(/