summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/scripts
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2008-07-22 19:31:41 +0000
committerNorbert Preining <preining@logic.at>2008-07-22 19:31:41 +0000
commit26ae85d15cf8cf070c2e1895713e948ecdb72a59 (patch)
tree134b94d6d178c249e0855b1b2e1a5f7edbfdd8c2 /Master/texmf-dist/scripts
parent29198cc2c0b1160486be5a93df4d2ef08a44e81b (diff)
update pdfcrop from CTAN to 1.11
git-svn-id: svn://tug.org/texlive/trunk@9709 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/scripts')
-rwxr-xr-xMaster/texmf-dist/scripts/pdfcrop/pdfcrop.pl27
1 files changed, 23 insertions, 4 deletions
diff --git a/Master/texmf-dist/scripts/pdfcrop/pdfcrop.pl b/Master/texmf-dist/scripts/pdfcrop/pdfcrop.pl
index 495cbfeb1e1..99d7af267a0 100755
--- a/Master/texmf-dist/scripts/pdfcrop/pdfcrop.pl
+++ b/Master/texmf-dist/scripts/pdfcrop/pdfcrop.pl
@@ -22,8 +22,8 @@ $^W=1; # turn warning on
#
my $file = "pdfcrop.pl";
my $program = uc($&) if $file =~ /^\w+/;
-my $version = "1.10";
-my $date = "2008/07/16";
+my $version = "1.11";
+my $date = "2008/07/22";
my $author = "Heiko Oberdiek";
my $copyright = "Copyright (c) 2002-2008 by $author.";
#
@@ -44,6 +44,7 @@ my $copyright = "Copyright (c) 2002-2008 by $author.";
# 2008/04/05 v1.9: Options --resolution and --bbox added.
# 2008/07/16 v1.10: Support for XeTeX added with new options
# --pdftex, --xetex, and --xetexcmd.
+# 2008/07/22 v1.11: Workaround for open("-|").
### program identification
my $title = "$program $version, $date - $copyright\n";
@@ -345,8 +346,26 @@ if ($::opt_bbox) {
@bbox = ($1, $2, $3, $4);
}
my $page = 0;
-my $pid = open(KID_TO_READ, "-|");
-if ($pid) { # parent
+# simulate open(FOO, "-|")
+# code from http://perldoc.perl.org/perlfork.html
+sub pipe_from_fork ($) {
+ my $parent = shift;
+ pipe $parent, my $child or die "!!! Error: Cannot open pi;e!\n";
+ my $pid = fork();
+ die "!!! Error: fork() failed: $!" unless defined $pid;
+ if ($pid) {
+ close $child;
+ }
+ else {
+ close $parent;
+ open(STDOUT, ">&=" . fileno($child))
+ or die "!!! Error: Redirecting STDOUT failed!\n";
+ }
+ $pid;
+}
+# my $pid = open(KID_TO_READ, "-|");
+# if ($pid) { # parent
+if (pipe_from_fork(*KID_TO_READ)) {
while (<KID_TO_READ>) {
my $bb = ($::opt_hires) ? "%%HiResBoundingBox" : "%%BoundingBox";
next unless