Blob


1 #!/bin/rc
2 # Generate paper output from the data that a PostScript program normally
3 # sends back to a host computer using file output operators.
4 #
6 POSTLIB=/sys/lib/postscript/prologues
7 PROLOGUE=$POSTLIB/hardcopy.ps
9 OPTIONS=
10 MODE=portrait
12 NONCONFORMING='%!PS'
13 ENDPROLOG='%%EndProlog'
14 BEGINSETUP='%%BeginSetup'
15 ENDSETUP='%%EndSetup'
16 TRAILER='%%Trailer'
18 SETUP=HardcopySetup
19 DONE='(%stdout)(w) file -1 write'
21 while (! ~ $#* 0 && ~ $1 -*) {
22 switch ($1) {
23 case -c; shift; OPTIONS=$OPTIONS' /#copies '$1' store'
24 case -c*; OPTIONS=$OPTIONS' /#copies `{echo $1 | sed s/-c//}' store'
26 case -f; shift; OPTIONS=$OPTIONS' /font '/$1' def'
27 case -f*; OPTIONS=$OPTIONS' /font '/`{echo $1 | sed s/-f//}' def'
29 case -p; shift; MODE=$1
30 case -p*; MODE=`{echo $1 | sed s/-p//}
32 case -m; shift; OPTIONS=$OPTIONS' /magnification '$1' def'
33 case -m*; OPTIONS=$OPTIONS' /magnification '`{echo $1 | sed s/-m//}' def'
35 case -s; shift; OPTIONS=$OPTIONS' /pointsize '$1' def'
36 case -s*; OPTIONS=$OPTIONS' /pointsize '`{echo $1 | sed s/-s//}' def'
38 case -x; shift; OPTIONS=$OPTIONS' /xoffset '$1' def'
39 case -x*; OPTIONS=$OPTIONS' /xoffset '`{echo $1 | sed s/-x//}' def'
41 case -y; shift; OPTIONS=$OPTIONS' /yoffset '$1' def'
42 case -y*; OPTIONS=$OPTIONS' /yoffset '`{echo $1 | sed s/-y//}' def'
44 case -L; shift; PROLOGUE=$1
45 case -L*; PROLOGUE=`{echo $1 | sed s/-L//}
47 case --;
49 case -*; echo '$0: illegal option $1' >&2; exit 1
50 }
51 shift
52 }
54 switch ($MODE) {
55 case l*; OPTIONS=$OPTIONS' /landscape true def'
56 case *; OPTIONS=$OPTIONS' /landscape false def'
57 }
59 echo $NONCONFORMING
60 cat $PROLOGUE
61 echo $ENDPROLOG
62 echo $BEGINSETUP
63 echo $OPTIONS
64 echo $SETUP
65 echo $ENDSETUP
67 cat $*
69 echo $TRAILER
70 echo $DONE