home *** CD-ROM | disk | FTP | other *** search
/ Mega Top 1 / os2_top1.zip / os2_top1 / APPS / TEKST / PSUTILS / FIXPSDIT.PL < prev    next >
Perl Script  |  1993-10-27  |  596b  |  26 lines

  1. #!@PERL@
  2. # fixpsditps: fix psdit output for use in psutils
  3.  
  4. # feed this into perl
  5. eval 'exec perl -S $0 "$@"'
  6.    if $running_under_some_shell;
  7.  
  8. $nesting = 0;
  9.  
  10. while (<>) {
  11.    if (/^\/p{pop showpage pagesave restore \/pagesave save def}def$/) {
  12.       print "/p{pop showpage pagesave restore}def\n";
  13.    } elsif (/^%%BeginDocument/ || /^%%BeginBinary/) {
  14.       print $_;
  15.       $nesting++;
  16.    } elsif (/^%%EndDocument/ || /^%%EndBinary/) {
  17.       print $_;
  18.       $nesting--;
  19.    } elsif (/^%%Page:/ && $nesting == 0) {
  20.       print $_;
  21.       print "xi\n";
  22.    } elsif (! /^xi$/) {
  23.       print $_;
  24.    }
  25. }
  26.