diff options
author | Karl Berry <karl@freefriends.org> | 2010-03-18 17:57:31 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2010-03-18 17:57:31 +0000 |
commit | 30b8b3af42e13008afcf519a3728063334c04866 (patch) | |
tree | a00a2c7fe1f8ef155f68517b6fd0cdc13dc16a11 /Build/source/extra/epstopdf/epstopdf.pl | |
parent | 3a34da02b29d467f1c112b1f7fdd5f1fa086b154 (diff) |
let --outfile override --filter; tex-k report from Julian Gilbey, 13 Mar 2010 22:36:39
git-svn-id: svn://tug.org/texlive/trunk@17496 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/extra/epstopdf/epstopdf.pl')
-rwxr-xr-x | Build/source/extra/epstopdf/epstopdf.pl | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/Build/source/extra/epstopdf/epstopdf.pl b/Build/source/extra/epstopdf/epstopdf.pl index c451a266074..4d291672385 100755 --- a/Build/source/extra/epstopdf/epstopdf.pl +++ b/Build/source/extra/epstopdf/epstopdf.pl @@ -46,9 +46,11 @@ use strict; # # emacs-page # History +# * let --outfile override --filter again. +# * recognize MSWin64 as well as MSWin32, just in case. # 2010/03/08 v2.14 (Manuel P\'egouri\'e-Gonnard) # * In restricted mode, forbid --gscmd (all platforms) and call GS with full -# path relative to self location (windows). +# path relative to self location (Windows). # 2010/02/26 v2.13 (Karl Berry) # * New release. # 2010/02/23 (Manuel P\'egouri\'e-Gonnard) @@ -154,9 +156,11 @@ There is NO WARRANTY, to the extent permitted by law. END_COPYRIGHT my $title = "$program $ident\n"; +my $on_windows = $^O =~ /^MSWin/; +my $on_windows_or_cygwin = $on_windows || $^O eq "cygwin"; + ### ghostscript command name -my $GS = "gs"; -$GS = "gswin32c" if $^O eq 'MSWin32'; +my $GS = $on_windows ? "gswin32c" : "gs"; ### restricted mode my $restricted = 0; @@ -247,9 +251,9 @@ sub errorUsage { die "Error: @_ (try --help for more information)\n"; } $restricted = 1 if $::opt_restricted; debug "Restricted mode activated" if $restricted; -### safer external commands for windows in restricted mode +### safer external commands for Windows in restricted mode my $kpsewhich = 'kpsewhich'; -if ($restricted and ($^O eq 'MSWin32')) { +if ($restricted && $on_windows) { use File::Basename; my $mydirname = dirname $0; # $mydirname is the location of the Perl script @@ -315,24 +319,24 @@ push @GS, qw(-q -dNOPAUSE -dSAFER -sDEVICE=pdfwrite); ### option outfile my $OutputFilename = $::opt_outfile; -if ($OutputFilename eq "") { +if (! $OutputFilename) { if ($::opt_gs) { - $OutputFilename = $InputFilename; - if (!$::opt_filter) { - my $ds = ($^O eq "MSWin32" || $^O eq "cygwin") ? '\\/' : '/'; + if ($::opt_filter) { + debug "Filtering: will write standard output"; + $OutputFilename = "-"; + } else { + # Ghostscript, no filter: replace input extension with .pdf. + $OutputFilename = $InputFilename; + my $ds = $on_windows_or_cygwin ? '\\/' : '/'; $OutputFilename =~ s/\.[^\.$ds]*$//; $OutputFilename .= ".pdf"; } } else { + debug "No Ghostscript: will write standard output"; $OutputFilename = "-"; # no ghostscript, write to standard output } } -if ($::opt_filter) { - debug "Filtering: will write standard output"; - $OutputFilename = "-"; -} else { - debug "Output filename:", $OutputFilename; -} +debug "Output filename:", $OutputFilename; push @GS, "-sOutputFile=$OutputFilename"; ### options compress, embed, res, autorotate @@ -392,7 +396,7 @@ my $tmp_filename; # temporary file for windows 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 + if (! $on_windows_or_cygwin) { # list piped open works push @GS, qw(- -c quit); debug "Ghostscript pipe:", join(' ', @GS); open($OUT, '|-', @GS) or error "Cannot open Ghostscript for piped input"; |