From 30b8b3af42e13008afcf519a3728063334c04866 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 18 Mar 2010 17:57:31 +0000 Subject: 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 --- Build/source/extra/epstopdf/Makefile | 11 +++++++++- Build/source/extra/epstopdf/epstopdf.1 | 24 +++++++++++----------- Build/source/extra/epstopdf/epstopdf.pl | 36 ++++++++++++++++++--------------- 3 files changed, 42 insertions(+), 29 deletions(-) (limited to 'Build') diff --git a/Build/source/extra/epstopdf/Makefile b/Build/source/extra/epstopdf/Makefile index 66895e60012..81adf697525 100644 --- a/Build/source/extra/epstopdf/Makefile +++ b/Build/source/extra/epstopdf/Makefile @@ -12,7 +12,7 @@ default: check check: check-help check-version \ check-help-r \ check-restricted-gscmd \ - check-filter check-write-error check-gscmd \ + check-filter check-filter-outfile check-write-error check-gscmd \ check-simple check-atend check-binary check-bin2 \ check-binhdr-lf check-binhdr-cr check-binhdr-crlf \ @@ -43,6 +43,15 @@ check-filter: cat test-simple.eps | $(e2p) --filter >test-filter.pdf pdfinfo test-filter.pdf | grep "Page size:" +check-filter-outfile: + rm -f test-filter.pdf + cat test-simple.eps | $(e2p) --filter --outfile=test-filter.pdf + pdfinfo test-filter.pdf | grep "Page size:" +# + rm -f test-filter.pdf + cat test-simple.eps | $(e2p) --outfile=test-filter.pdf --filter + pdfinfo test-filter.pdf | grep "Page size:" + check-write-error: -$(e2p) test-simple.eps --outfile=/dev/full diff --git a/Build/source/extra/epstopdf/epstopdf.1 b/Build/source/extra/epstopdf/epstopdf.1 index 60ac00a8e73..d5f0ab9ac43 100644 --- a/Build/source/extra/epstopdf/epstopdf.1 +++ b/Build/source/extra/epstopdf/epstopdf.1 @@ -1,6 +1,5 @@ -.TH EPSTOPDF 1 "9 March 2010" +.TH EPSTOPDF 1 "18 March 2010" .\" $Id$ -.\" man page originally by Jim Van Zandt .SH NAME epstopdf, repstopdf \- convert an EPS file to PDF .SH SYNOPSIS @@ -16,9 +15,10 @@ result is piped to Ghostscript and a PDF version written. If the bounding box is not right, of course, there are problems. .SH OPTIONS .IP "\fB--outfile\fP=\fIfile\fP" -write result to \fIfile\fP; the default is to construct the output file -name by replacing any extension in the input file with \fI.pdf\fP. If -\fB--nogs\fP or \fB--filter\fP is specified, write to standard output. +write result to \fIfile\fP. If this option is not given, and +\fB--nogs\fP or \fB--filter\fP is specified, write to standard output; +otherwise, the default is to construct the output file name by replacing +any extension in the input file with \fI.pdf\fP. .IP "\fB--\fP[\fBno\fP]\fBcompress\fP" use compression (default: on). .IP "\fB--\fP[\fBno\fP]\fBdebug\fP" @@ -28,9 +28,10 @@ embed fonts (default: on). .IP "\fB--\fP[\fBno\fP]\fBexact\fP" scan ExactBoundingBox (default: off). .IP "\fB--\fP[\fBno\fP]\fBfilter\fP" -read standard input (default: off). +read standard input and (unless \fB--outfile\fP is given) write standard +output(default: off). .IP "\fB--\fP[\fBno\fP]\fBgs\fP" -run ghostscript (default: on). +run Ghostscript (default: on). .IP "\fB--\fP[\fBno\fP]\fBhires\fP" scan HiresBoundingBox (default: off). .IP "\fB--gscmd\fP=\fIval\fP" @@ -55,15 +56,14 @@ Examples which produce "test.pdf": epstopdf test.eps produce postscript | epstopdf --filter >test.pdf produce postscript | epstopdf -f -d -o=test.pdf - .fi Example: look for HiresBoundingBox and produce corrected PostScript: .nf epstopdf -d --nogs --hires test.ps >testcorr.ps .fi .SH BUGS -The case of "%%BoundingBox: (atend)" -when input is not seekable (e.g., from a pipe) is not supported. +The case of "%%BoundingBox: (atend)" when input is not seekable (e.g., +from a pipe) is not supported. .PP Report bugs in the program or this man page to tex-k@tug.org. When reporting bugs, please include an input file and the command line @@ -76,8 +76,8 @@ The epstopdf LaTeX package, part of the oberdiek bundle, which automates running this script on the fly under TeX: http://ctan.org/pkg/epstopdf-pkg. .SH AUTHOR The script was originally written by Sebastian Rahtz, for Elsevier -Science, with subsequent contributions from Gerben Wierda and many -others. Currently maintained by Karl Berry. +Science, with subsequent contributions from Thomas Esser, Gerben Wierda +and many others. Currently maintained by Karl Berry. .PP Man page originally written by Jim Van Zandt. .PP 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"; -- cgit v1.2.3