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

  1. extproc perl -Sx 
  2. #!perl
  3. # fixtpps: fix tpscript document to work with PSUtils
  4.  
  5. # feed this into perl
  6. eval 'exec perl -S $0 "$@"'
  7.    if $running_under_some_shell;
  8.  
  9. $nesting = 0;
  10. $header = 1;
  11.  
  12. while (<>) {
  13.    if (/^%%Page:/ && $nesting == 0) {
  14.       print $_;
  15.       print "save home\n";
  16.       $header = 0;
  17.    } elsif (/^%%BeginDocument/ || /^%%BeginBinary/) {
  18.       print $_;
  19.       $nesting++;
  20.    } elsif (/^%%EndDocument/ || /^%%EndBinary/) {
  21.       print $_;
  22.       $nesting--;
  23.    } elsif (/save home/) {
  24.       s/save home//;
  25.       print $_;
  26.    } elsif (!$header || (! /^save$/ && ! /^home$/)) {
  27.       print $_;
  28.    }
  29. }
  30.