diff options
author | Karl Berry <karl@freefriends.org> | 2009-12-01 23:59:15 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2009-12-01 23:59:15 +0000 |
commit | 131deb0cf31b15c4961cb831a662d127d3237e67 (patch) | |
tree | d19f8ddafd0af1df6a08b125590a51d5e96dac6d /Build/source | |
parent | efe1314da0fab691249b38434cb969f8a076fa77 (diff) |
epstopdf 2.12 (1dec09)
git-svn-id: svn://tug.org/texlive/trunk@16262 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source')
-rwxr-xr-x | Build/source/texk/texlive/linked_scripts/epstopdf/epstopdf.pl | 84 |
1 files changed, 44 insertions, 40 deletions
diff --git a/Build/source/texk/texlive/linked_scripts/epstopdf/epstopdf.pl b/Build/source/texk/texlive/linked_scripts/epstopdf/epstopdf.pl index 8254f2a5c42..a312a9b7f90 100755 --- a/Build/source/texk/texlive/linked_scripts/epstopdf/epstopdf.pl +++ b/Build/source/texk/texlive/linked_scripts/epstopdf/epstopdf.pl @@ -2,7 +2,7 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' && eval 'exec perl -S $0 $ if 0; use strict; -# $Id: epstopdf.pl 15569 2009-09-30 00:21:49Z karl $ +# $Id: epstopdf.pl 16244 2009-11-30 01:36:08Z karl $ # (Copyright lines below.) # # Redistribution and use in source and binary forms, with or without @@ -47,12 +47,16 @@ use strict; # # emacs-page # History -# 2009/10/18 v2.13 (Manuel Pégourié-Gonnard) -# * Better argument validation, from Alexander Cherepanov. -# * Use the list form of pipe open() (resp. system()) to prevent injection. +# 2009/11/27 v2.12 (Karl Berry) +# * Make --filter work again +# 2009/11/25 (Manuel P\'egouri\'e-Gonnard) +# * Better extension detection, suggested by A. Cherepanov. +# 2009/10/18 (Manuel P\'egouri\'e-Gonnard) +# * Better argument validation (Alexander Cherepanov). +# * Use list form of pipe open() (resp. system()) to prevent injection. # Since Perl's fork() emulation doesn't work on Windows with Perl 5.8.8 from # TeX Live 2009, use a temporary file instead of a pipe on Windows. -# 2009/10/14 v2.12 (Manuel Pégourié-Gonnard) +# 2009/10/14 (Manuel P\'egouri\'e-Gonnard) # * Added restricted mode. # 2009/09/27 v2.11 (Karl Berry) # * Fixed two bugs in the (atend) handling code (Martin von Gagern) @@ -129,11 +133,11 @@ use strict; ### program identification my $program = "epstopdf"; -my $ident = '($Id: epstopdf.pl 15569 2009-09-30 00:21:49Z karl $) 2.11'; +my $ident = '($Id: epstopdf.pl 16244 2009-11-30 01:36:08Z karl $) 2.12'; my $copyright = <<END_COPYRIGHT ; -Copyright 1998-2001 Sebastian Rahtz et al. -Copyright 2002-2009 Gerben Wierda et al. Copyright 2009 Karl Berry et al. +Copyright 2002-2009 Gerben Wierda et al. +Copyright 1998-2001 Sebastian Rahtz et al. License RBSD: Revised BSD <http://www.xfree86.org/3.3.6/COPYRIGHT2.html#5> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. @@ -258,10 +262,8 @@ my $InputFilename = ""; if ($::opt_filter) { @ARGV == 0 or die errorUsage "Input file cannot be used with filter option"; - $InputFilename = "-"; - debug "Input file: standard input"; -} -else { + debug "Filtering: will read standard input"; +} else { @ARGV > 0 or die errorUsage "Input filename missing"; @ARGV < 2 or die errorUsage "Unknown option or too many input files"; $InputFilename = $ARGV[0]; @@ -285,6 +287,28 @@ if ($::opt_gscmd) { my @GS = ($GS); push @GS, qw(-q -dNOPAUSE -dSAFER -sDEVICE=pdfwrite); +### option outfile +my $OutputFilename = $::opt_outfile; +if ($OutputFilename eq "") { + if ($::opt_gs) { + $OutputFilename = $InputFilename; + if (!$::opt_filter) { + my $ds = ($^O eq "MSWin32" || $^O eq "cygwin") ? '\\/' : '/'; + $OutputFilename =~ s/\.[^\.$ds]*$//; + $OutputFilename .= ".pdf"; + } + } else { + $OutputFilename = "-"; # no ghostscript, write to standard output + } +} +if ($::opt_filter) { + debug "Filtering: will write standard output"; + $OutputFilename = "-"; +} else { + debug "Output filename:", $OutputFilename; +} +push @GS, "-sOutputFile=$OutputFilename"; + ### options compress, embed, res, autorotate push @GS, ('-dPDFSETTINGS=/prepress', '-dMaxSubsetPct=100', '-dSubsetFonts=true', '-dEmbedAllFonts=true') if $::opt_embed; @@ -307,28 +331,6 @@ $BBName = "%%HiResBoundingBox:" if $::opt_hires; $BBName = "%%ExactBoundingBox:" if $::opt_exact; debug "BoundingBox comment:", $BBName; -### option outfile -my $OutputFilename = $::opt_outfile; -if ($OutputFilename eq "") { - if ($::opt_gs) { - $OutputFilename = $InputFilename; - if (!$::opt_filter) { - $OutputFilename =~ s/\.[^\.]*$//; - $OutputFilename .= ".pdf"; - } - } - else { - $OutputFilename = "-"; # standard output - } -} -if ($::opt_filter) { - debug "Output file: standard output"; -} -else { - debug "Output filename:", $OutputFilename; -} -push @GS, "-sOutputFile=$OutputFilename"; - ### validate output file name in restricted mode \label{openout_any} use File::Spec::Functions qw(splitpath file_name_is_absolute); if ($restricted) { @@ -367,8 +369,11 @@ if ($::opt_gs) { ### emacs-page ### open input file -open(IN, '<', $InputFilename) or error "Cannot open", - ($::opt_filter) ? "standard input" : "\"$InputFilename\": $!"; +if ($::opt_filter) { + open(IN, '<-') || error("Cannot open stdin: $!"); +} else { + open(IN, '<', $InputFilename) || error("Cannot open $InputFilename: $!"); +} binmode IN; ### open output file @@ -378,11 +383,10 @@ my $OUT; # filehandle for output (GS pipe or temporary file) use File::Temp 'tempfile'; if ($::opt_gs) { unless ($^O eq 'MSWin32' || $^O eq 'cygwin') { # list piped open works - push @GS, qw(- -c -quit); + push @GS, qw(- -c quit); debug "Ghostscript pipe:", join(' ', @GS); open($OUT, '|-', @GS) or error "Cannot open Ghostscript for piped input"; - } - else { # use a temporary file + } else { # use a temporary file on Windows/Cygwin. ($OUT, $tmp_filename) = tempfile(UNLINK => 1); debug "Using temporary file '$tmp_filename'"; } @@ -579,4 +583,4 @@ if ($? & 127) { } warning "BoundingBox not found" unless $BBCorrected; -debug "Ready."; +debug "Done."; |