- new implementation of psmerge by Peter Williams
This commit is contained in:
parent
04aa638456
commit
a84d0efd59
153
psutils-psmerge.patch
Normal file
153
psutils-psmerge.patch
Normal file
@ -0,0 +1,153 @@
|
||||
--- psutils/psmerge.pl.new 2006-06-12 09:53:37.000000000 +0200
|
||||
+++ psutils/psmerge.pl 2006-06-12 09:53:47.000000000 +0200
|
||||
@@ -1,11 +1,19 @@
|
||||
-@PERL@
|
||||
+#!/usr/bin/perl
|
||||
+eval 'exec perl -S $0 "$@"'
|
||||
+ if (1 == 0);
|
||||
+
|
||||
# psmerge: merge PostScript files produced by same application and setup
|
||||
-# usage: psmerge [-oout.ps] [-thorough] file1.ps file2.ps ...
|
||||
+# usage: psmerge [-oout.ps] file1.ps file2.ps ...
|
||||
#
|
||||
# Copyright (C) Angus J. C. Duggan 1991-1995
|
||||
# See file LICENSE for details.
|
||||
+#
|
||||
+# Unbroken (or, broken in a different way that at least sometimes
|
||||
+# works) by Peter Williams 2003 <peter@newton.cx>
|
||||
+
|
||||
|
||||
-$prog = ($0 =~ s=.*/==);
|
||||
+$prog = $0;
|
||||
+$prog =~ s=.*/==;
|
||||
|
||||
while ($ARGV[0] =~ /^-/) {
|
||||
$_ = shift;
|
||||
@@ -14,72 +22,75 @@
|
||||
print STDERR "$prog: can't open $1 for output\n";
|
||||
exit 1;
|
||||
}
|
||||
- } elsif (/^-t(horough)?$/) {
|
||||
- $thorough = 1;
|
||||
} else {
|
||||
- print STDERR "Usage: $prog [-oout] [-thorough] file...\n";
|
||||
+ print STDERR "Usage: $prog [-oout] file1 file2...\n";
|
||||
exit 1;
|
||||
}
|
||||
}
|
||||
|
||||
$page = 0;
|
||||
$first = 1;
|
||||
+$seenpages = 0;
|
||||
$nesting = 0;
|
||||
|
||||
-@header = ();
|
||||
-$header = 1;
|
||||
-
|
||||
@trailer = ();
|
||||
-$trailer = 0;
|
||||
-
|
||||
-@pages = ();
|
||||
-@body = ();
|
||||
-
|
||||
-@resources = ();
|
||||
-$inresource = 0;
|
||||
+$trailermode = 0;
|
||||
|
||||
while (<>) {
|
||||
- if (/^%%BeginFont:/ || /^%%BeginResource:/ || /^%%BeginProcSet:/) {
|
||||
- $inresource = 1;
|
||||
- push(@resources, $_);
|
||||
- } elsif ($inresource) {
|
||||
- push(@resources, $_);
|
||||
- $inresource = 0 if /^%%EndFont/ || /^%%EndResource/ || /^%%EndProcSet/;
|
||||
- } elsif (/^%%Page:/ && $nesting == 0) {
|
||||
- $header = $trailer = 0;
|
||||
- push(@pages, join("", @body)) if @body;
|
||||
- $page++;
|
||||
- @body = ("%%Page: ($page) $page\n");
|
||||
- } elsif (/^%%Trailer/ && $nesting == 0) {
|
||||
- push(@trailer, $_);
|
||||
- push(@pages, join("", @body)) if @body;
|
||||
- @body = ();
|
||||
- $trailer = 1;
|
||||
- $header = 0;
|
||||
- } elsif ($header) {
|
||||
- push(@trailer, $_);
|
||||
- push(@pages, join("", @body)) if @body;
|
||||
- @body = ();
|
||||
- $trailer = 1;
|
||||
- $header = 0;
|
||||
- } elsif ($trailer) {
|
||||
- if (/^%!/ || /%%EOF/) {
|
||||
- $trailer = $first = 0;
|
||||
- } elsif ($first) {
|
||||
- push(@trailer, $_);
|
||||
- }
|
||||
- } elsif (/^%%BeginDocument/ || /^%%BeginBinary/ || /^%%BeginFile/) {
|
||||
- push(@body, $_);
|
||||
- $nesting++;
|
||||
- } elsif (/^%%EndDocument/ || /^%%EndBinary/ || /^%%EndFile/) {
|
||||
- push(@body, $_);
|
||||
- $nesting--;
|
||||
- } else {
|
||||
- print $_ if $print;
|
||||
- }
|
||||
+ if ($seenpages == 0) {
|
||||
+ if (/^%%Page:/) {
|
||||
+ if ($nesting == 0) {
|
||||
+ $seenpages = 1;
|
||||
+ $page++;
|
||||
+ print "%%Page: ($page) $page\n";
|
||||
+ } else {
|
||||
+ print $_;
|
||||
+ }
|
||||
+ } elsif ($first) {
|
||||
+ if (/^%%Pages: /) {
|
||||
+ print "%%Pages: (atend)\n";
|
||||
+ } else {
|
||||
+ print $_;
|
||||
+ }
|
||||
+ }
|
||||
+ } elsif ($trailermode) {
|
||||
+ if (/^%!/ || /%%EOF/) {
|
||||
+ $seenpages = 0;
|
||||
+ $first = 0;
|
||||
+ $trailermode = 0;
|
||||
+ } elsif ($first) {
|
||||
+ push (@trailer, $_)
|
||||
+ unless (/^%%Pages/);
|
||||
+ }
|
||||
+ } else {
|
||||
+ if (/^%%Page:/) {
|
||||
+ if ($nesting == 0) {
|
||||
+ $seenpages = 1;
|
||||
+ $page++;
|
||||
+ print "%%Page: ($page) $page\n";
|
||||
+ } else {
|
||||
+ print $_;
|
||||
+ }
|
||||
+ } elsif (/^%%Trailer/ && $nesting == 0) {
|
||||
+ $trailermode = 1;
|
||||
+ } elsif (/^%%BeginDocument/ || /^%%BeginBinary/ || /^%%BeginFile/) {
|
||||
+ push(@body, $_);
|
||||
+ $nesting++;
|
||||
+ print $_;
|
||||
+ } elsif (/^%%EndDocument/ || /^%%EndBinary/ || /^%%EndFile/) {
|
||||
+ push(@body, $_);
|
||||
+ $nesting--;
|
||||
+ print $_;
|
||||
+ } else {
|
||||
+ print $_;
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
|
||||
+print "%%Trailer\n";
|
||||
print @trailer;
|
||||
+print "%%Pages: $page\n";
|
||||
+print "%%EOF\n";
|
||||
|
||||
exit 0;
|
||||
-@END@
|
||||
+
|
@ -1,7 +1,7 @@
|
||||
Summary: PostScript Utilities
|
||||
Name: psutils
|
||||
Version: 1.17
|
||||
Release: 25.2.1
|
||||
Release: 26
|
||||
License: distributable
|
||||
Group: Applications/Publishing
|
||||
Source: ftp://ftp.dcs.ed.ac.uk/pub/ajcd/psutils-p17.tar.gz
|
||||
@ -10,6 +10,7 @@ Patch1: psutils-p17-misc.patch
|
||||
Patch2: psutils-p17-paper.patch
|
||||
Patch3: psutils-p17-strip.patch
|
||||
Patch4: psutils-manpage.patch
|
||||
Patch5: psutils-psmerge.patch
|
||||
BuildRoot: %{_tmppath}/psutils-root
|
||||
|
||||
%description
|
||||
@ -24,6 +25,7 @@ signatures for booklet printing, and page merging for n-up printing.
|
||||
%patch2 -p1 -b .paper
|
||||
%patch3 -p1 -b .strip
|
||||
%patch4 -p1 -b .manpage
|
||||
%patch5 -p1 -b .new
|
||||
|
||||
%build
|
||||
make -f Makefile.unix RPM_OPT_FLAGS="$RPM_OPT_FLAGS"
|
||||
@ -46,6 +48,9 @@ rm -rf $RPM_BUILD_ROOT
|
||||
/usr/lib/psutils
|
||||
|
||||
%changelog
|
||||
* Mon Jun 12 2006 Jitka Kudrnacova <jkudrnac@redhat.com> - 1.17-26
|
||||
- new implementation of psmerge by Peter Williams
|
||||
|
||||
* Fri Feb 10 2006 Jesse Keating <jkeating@redhat.com> - 1.17-25.2.1
|
||||
- bump again for double-long bug on ppc(64)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user