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

  1. #!@PERL@
  2. # fixwpps: get semi-conforming PostScript out of WordPerfect 5.0 file
  3.  
  4. # feed this into perl
  5. eval 'exec perl -S $0 "$@"'
  6.    if $running_under_some_shell;
  7.  
  8. $page = 1;
  9. $nesting = 0;
  10.  
  11. while (<>) {
  12.    s/([^\/]_t)([0-9]+)/\1 \2/g;    # fix wp 5.0 bug
  13.    if (m!/_[be][dp]! || m!_bp \d+ \d+ roll!) {
  14.       print $_;
  15.    } elsif (/^(.*)(_bp.*)$/) {
  16.       print "$1\n" if $1 ne "";
  17.       print "%%Page: $page $page\n";
  18.       print "$2\n";
  19.       $page++;
  20.       $nesting++;
  21.    } elsif (/_ep$/) {
  22.       print $_;
  23.       $nesting--;
  24.    } elsif (/^(.*)(_ed.*)/) {
  25.       print "$1\n" if $1 ne "";
  26.       print "%%Trailer:\n";
  27.       print "$2\n";
  28.    } else {
  29.       print $_;
  30.    }
  31. }
  32.