File: pscaps.sh

package info (click to toggle)
pgplot5 5.2-13
  • links: PTS
  • area: non-free
  • in suites: potato
  • size: 6,280 kB
  • ctags: 5,903
  • sloc: fortran: 37,938; ansic: 18,809; sh: 1,147; objc: 532; makefile: 363; perl: 234; pascal: 233; tcl: 178; awk: 51; csh: 25
file content (39 lines) | stat: -rwxr-xr-x 1,176 bytes parent folder | download | duplicates (15)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/csh
#
# Move BoundingBox statement in PostScript files from epilogue to
# prologue. This is useful for use with some applications which don't
# fully implement the Adobe DSC for Encapsulated PostScript (eg. they
# don't support a deferred bounding box specification using
# %%BoundingBox: (atend)
#
# Version 1.0: RGW 12-Apr-1994
# Version 1.1: RGW 29-Jan-1995
#
# Usage: pscaps <list of files>
#
#
set version="1.1"
set tmpfile=pscaps.tempfile
unalias mv
echo "PSCaps Version $version (rgw 29-Jan-1995)"
foreach file ($*)
  if ( -e $file ) then
    echo "Processing file $file..."
    set truebox=`fgrep '%%BoundingBox:' $file|fgrep -v atend`
    set atline=`fgrep -n '%%BoundingBox: (atend)' $file|awk -F':' '{print $1}'`
    if ($atline == "" ) then
      echo "File '$file' does not contain %%BoundingBox: (atend) construct"
      echo "Not a PGPLOT file, or already pscaps'ed"
    else
      @ prologue = $atline - 1
      @ restoffile = $atline + 1
      head -$prologue $file >! $tmpfile
      echo $truebox >> $tmpfile
      tail +${restoffile}l $file >> $tmpfile
      mv $tmpfile $file
    endif
  else
    echo "File '$file' does not exist"
  endif
end
exit