diff options
Diffstat (limited to 'lib/sbin')
-rwxr-xr-x | lib/sbin/FixPageNumbersInPostscript.pl | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/lib/sbin/FixPageNumbersInPostscript.pl b/lib/sbin/FixPageNumbersInPostscript.pl new file mode 100755 index 00000000..f8253eaa --- /dev/null +++ b/lib/sbin/FixPageNumbersInPostscript.pl @@ -0,0 +1,44 @@ +#!/usr/bin/perl -w +#/*@@ +# @routine FixPageNumbersInPostscript.pl +# @date Fri 15 Mar 2002 +# @author Thomas Radke +# @desc +# Fixes the line numbers in the postscript versions of the +# Cactus UsersGuide, ThornGuide, and MaintGuide +# @enddesc +# @version $Header$ +#@@*/ + +# $part counts the parts (chapters) in the postscript file +$part = 0; + +# @part_letters lists the numbering for all the parts +# the first two parts (title page and table of contents) are skipped +@part_letters = ('', '', 'A' .. 'Z'); + +# $last_line must match EOP in order to check for a new page +$last_line = "eop\n"; + + +# skip all lines in the postscript setup and prolog +while (<>) +{ + print; + last if (/^%%EndProlog\n$/); +} + + +while (<>) +{ + if ($last_line =~ /eop$/ && /^%%Page: (\d+) (\d+)$/) + { + $part++ if ($1 == 1); + $_ = "%%Page: ${part_letters[$part]}$1 $2\n"; + } + + print; + $last_line = $_; +} + +1; |