Constitutional Crisis: Fix typos and formatting errors
[ccbib.git] / psutils / fixtpps.pl
blob29c2cebb15c01e233e3a0bc75c2cbe62d2cc92c9
1 @PERL@
2 # fixtpps: fix tpscript document to work with PSUtils
4 # Copyright (C) Angus J. C. Duggan 1991-1995
5 # See file LICENSE for details.
7 $nesting = 0;
8 $header = 1;
10 while (<>) {
11 if (/^%%Page:/ && $nesting == 0) {
12 print $_;
13 print "save home\n";
14 $header = 0;
15 } elsif (/^%%BeginDocument/ || /^%%BeginBinary/ || /^%%BeginFile/) {
16 print $_;
17 $nesting++;
18 } elsif (/^%%EndDocument/ || /^%%EndBinary/ || /^%%EndFile/) {
19 print $_;
20 $nesting--;
21 } elsif (/save home/) {
22 s/save home//;
23 print $_;
24 } elsif (!$header || (! /^save$/ && ! /^home$/)) {
25 print $_;
28 @END@