home *** CD-ROM | disk | FTP | other *** search
/ Mega Top 1 / os2_top1.zip / os2_top1 / APPS / TEKST / PSUTILS / FIXPSDIT.CMD < prev    next >
OS/2 REXX Batch file  |  1994-01-14  |  638b  |  27 lines

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