home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / gnu / graphics-0.17 / plot2ps / atend.pl < prev    next >
Encoding:
Perl Script  |  1990-09-09  |  565 b   |  18 lines

  1. #!/usr/local/bin/perl
  2. # this perl script moves the bounding box to the beginning of a eps file.
  3. unshift(@ARGV, '-') if $#ARGV < $[;
  4. while ($ARGV = shift)
  5. { open(ARGV, $ARGV);
  6.   read (ARGV, $data, 2**23);    # 8 meg file size limit
  7.   open(ARGVOUT, ">$ARGV");
  8.   if ($data =~ m/%%BoundingBox: *\(atend\)/)
  9.   { if ($data =~ m/%%BoundingBox: *\d+ +\d+ +\d+ +\d+/)
  10.     { $bbox = $&;
  11.       $data =~ s/$bbox//;
  12.       $data =~ s/%%BoundingBox: *\(atend\)/$bbox/;}}
  13.   print ARGVOUT $data;
  14.   close ARGVOUT;}
  15. # local variables:
  16. # compile-command: "./atend.pl - <spline.ps"
  17. # end:
  18.