~ubuntu-branches/ubuntu/jaunty/texlive-bin/jaunty-security

« back to all changes in this revision

Viewing changes to build/TeX/utils/psutils/psmerge.pl

  • Committer: Bazaar Package Importer
  • Author(s): Norbert Preining
  • Date: 2008-06-26 23:14:59 UTC
  • mfrom: (2.1.30 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080626231459-y02rjsrgtafu83yr
Tags: 2007.dfsg.2-3
add missing source roadmap.fig of roadmap.eps in fontinst documentation
(Closes: #482915) (urgency medium due to RC bug)
(new patch add-missing-fontinst-source)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
@PERL@
2
 
# psmerge: merge PostScript files produced by same application and setup
3
 
# usage: psmerge [-oout.ps] [-thorough] file1.ps file2.ps ...
4
 
#
5
 
# Copyright (C) Angus J. C. Duggan 1991-1995
6
 
# See file LICENSE for details.
7
 
 
8
 
$prog = ($0 =~ s=.*/==);
9
 
 
10
 
while ($ARGV[0] =~ /^-/) {
11
 
   $_ = shift;
12
 
   if (/^-o(.+)/) {
13
 
      if (!close(STDOUT) || !open(STDOUT, ">$1")) {
14
 
         print STDERR "$prog: can't open $1 for output\n";
15
 
         exit 1;
16
 
      }
17
 
   } elsif (/^-t(horough)?$/) {
18
 
      $thorough = 1;
19
 
   } else {
20
 
      print STDERR "Usage: $prog [-oout] [-thorough] file...\n";
21
 
      exit 1;
22
 
   }
23
 
}
24
 
 
25
 
$page = 0;
26
 
$first = 1;
27
 
$nesting = 0;
28
 
 
29
 
@header = ();
30
 
$header = 1;
31
 
 
32
 
@trailer = ();
33
 
$trailer = 0;
34
 
 
35
 
@pages = ();
36
 
@body = ();
37
 
 
38
 
@resources = ();
39
 
$inresource = 0;
40
 
 
41
 
while (<>) {
42
 
   if (/^%%BeginFont:/ || /^%%BeginResource:/ || /^%%BeginProcSet:/) {
43
 
      $inresource = 1;
44
 
      push(@resources, $_);
45
 
   } elsif ($inresource) {
46
 
      push(@resources, $_);
47
 
      $inresource = 0 if /^%%EndFont/ || /^%%EndResource/ || /^%%EndProcSet/;
48
 
   } elsif (/^%%Page:/ && $nesting == 0) {
49
 
      $header = $trailer = 0;
50
 
      push(@pages, join("", @body)) if @body;
51
 
      $page++;
52
 
      @body = ("%%Page: ($page) $page\n");
53
 
   } elsif (/^%%Trailer/ && $nesting == 0) {
54
 
      push(@trailer, $_);
55
 
      push(@pages, join("", @body)) if @body;
56
 
      @body = ();
57
 
      $trailer = 1;
58
 
      $header = 0;
59
 
   } elsif ($header) {
60
 
      push(@trailer, $_);
61
 
      push(@pages, join("", @body)) if @body;
62
 
      @body = ();
63
 
      $trailer = 1;
64
 
      $header = 0;
65
 
   } elsif ($trailer) {
66
 
      if (/^%!/ || /%%EOF/) {
67
 
         $trailer = $first = 0;
68
 
      } elsif ($first) {
69
 
         push(@trailer, $_);
70
 
      }
71
 
   } elsif (/^%%BeginDocument/ || /^%%BeginBinary/ || /^%%BeginFile/) {
72
 
      push(@body, $_);
73
 
      $nesting++;
74
 
   } elsif (/^%%EndDocument/ || /^%%EndBinary/ || /^%%EndFile/) {
75
 
      push(@body, $_);
76
 
      $nesting--;
77
 
   } else {
78
 
      print $_ if $print;
79
 
   }
80
 
}
81
 
 
82
 
print @trailer;
83
 
 
84
 
exit 0;
85
 
@END@