--- loncom/interface/printout.pl 2004/08/04 18:19:11 1.62 +++ loncom/interface/printout.pl 2004/08/05 18:18:15 1.63 @@ -1,7 +1,7 @@ #!/usr/bin/perl # CGI-script to run LaTeX, dvips, ps2ps, ps2pdf etc. # -# $Id: printout.pl,v 1.62 2004/08/04 18:19:11 sakharuk Exp $ +# $Id: printout.pl,v 1.63 2004/08/05 18:18:15 sakharuk Exp $ # # Copyright Michigan State University Board of Trustees # @@ -194,13 +194,19 @@ foreach $texfile (@texfile) { "for $status_statement now LaTeXing file", \%prog_state,$dvi_file); if ($tableofcontents eq 'yes') { - system("latex $name_file 1>/dev/null 2>/dev/null"); + &busy_wait_command("latex $name_file 1>/dev/null 2>/dev/null", + "for $status_statement now LaTeXing file for table of contents", + \%prog_state,$dvi_file); } #to create table of contents my $idxname=$name_file; $idxname=~s/\.tex$/\.idx/; if ($tableofindex eq 'yes') { - system("makeindex $idxname"); - system("latex $name_file 1>/dev/null 2>/dev/null"); + &busy_wait_command("makeindex $idxname", + "making index file", + \%prog_state,$idxname); + &busy_wait_command("latex $name_file 1>/dev/null 2>/dev/null", + "for $status_statement now LaTeXing file for index section", + \%prog_state,$dvi_file); } #to create index #Do we have a latex error in the log file? my $logfilename = $texfile; @@ -291,8 +297,10 @@ foreach $texfile (@texfile) { my $papera=$papers[$paper]; if ($papera ne '') {$papera='-p'.$papera;} $comma = 'pstops '.$papera.' "2:0+1(0.48w,0)"'; - system("$comma $new_name_file $tempo_file 1>/dev/null 2>/dev/null"); - system("ps2pdf $tempo_file $name_file 1>/dev/null 2>/dev/null"); + &busy_wait_command("$comma $new_name_file $tempo_file 1>/dev/null 2>/dev/null", + "for $status_statement now Modifying PS layout", + \%prog_state,$tempo_file); + } else { $ps_file=$new_name_file; } @@ -369,15 +377,17 @@ foreach $texfile (@texfile) { } if ($paper eq '6') { open(FFH,'<',$ps_file) || die "Couldn't open file for reading: $!\n"; - my @content_of_file = ; - close(FFH); - open(FFH,'>',$ps_file) || die "Couldn't open file for writing: $!\n"; - print FFH '<< /PageSize [595.2 842] >> setpagedevice'."\n"; - for (my $i=0;$i<=$#content_of_file;$i++) { - print FFH $content_of_file[$i]; - print "
$i
"; + my $new_ps_file='new'.$ps_file; + open(FFHS,'>',$new_ps_file) || die "Couldn't open file for reading: $!\n"; + my $i=-1; + while () { + $i++; + if ($i==0) {print FFHS '<< /PageSize [595.2 842] >> setpagedevice'."\n";} + print FFHS $_; } - close(FFH); + close(FFH); + close(FFHS); + $ps_file=$new_ps_file; } &busy_wait_command("ps2pdf $ps_file $pdf_file 1>/dev/null 2>/dev/null", "for $status_statement now Converting PS to PDF", @@ -397,7 +407,7 @@ foreach $texfile (@texfile) { print "$link_text"; print "\n"; } - } + } } else { print "LaTeX file $texfile was not created successfully"; }