eval '(exit $?0)' && eval 'exec perl5 -S $0 ${1+"$@"}' && eval 'exec perl5 -S $0 $argv:q' if 0; #------------------------------------------------- sub Myexecute { local($command) = $_[0]; printf "\tExecuting: $command\n"; system($command); } if ($#ARGV < 0) { print "\nmultiepstopdf [file1] [file2] [file3]\n"; print 'Xenios Papademetris, papad@noodle.med.yale.edu, March 2000.',"\n\n"; print "This script is a shell around epstopdf which in turn is a shell around gs!\n"; print "It can be used to convert multiple .ps or .eps files (including compressed\n and gzipped vesions) to .pdf for use with pdflatex.\n\n"; print "\t",'e.g. multiepstopdf hello.eps',"\n"; print "\t",'e.g. multiepstopdf *.eps *.eps.gz *.ps.Z ',"\n"; exit(0); } $command="epstopdf"; $suffix1=".pdf"; $suffix2=".eps"; while (@ARGV) { $oldname=shift(ARGV); $compress=0; $gzip=0; printf "\nExamining $oldname\n"; if ($oldname =~ /\.Z$/) { $compress=1; Myexecute("compress -d $oldname"); $oldname =~ s/\.Z//; } elsif ($oldname =~ /\.gz$/) { $gzip=1; Myexecute("gzip -d $oldname"); $oldname =~ s/\.gz//; } $newname=$oldname; # printf "\t gzipped=$gzip, compressed=$compress oldname=$oldname, newname=$newname\n"; if ($newname =~ /\.eps/) { $newname =~ s/\.eps/.pdf/; } elsif ($newname =~ /\.ps/) { $newname =~ s/\.ps/.pdf/; } else { $newname .= ".pdf";} Myexecute("epstopdf -d --outfile=$newname $oldname"); if ($compress) { Myexecute("compress $oldname");} elsif ($gzip) { Myexecute("gzip $oldname");} }