aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/postscript/hardcopy/hardcopy.rc
blob: 0077aa71629fefaaa14cb547c816381a5565203a (plain)
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/rc
# Generate paper output from the data that a PostScript program normally
# sends back to a host computer using file output operators.
#

POSTLIB=/sys/lib/postscript/prologues
PROLOGUE=$POSTLIB/hardcopy.ps

OPTIONS=
MODE=portrait

NONCONFORMING='%!PS'
ENDPROLOG='%%EndProlog'
BEGINSETUP='%%BeginSetup'
ENDSETUP='%%EndSetup'
TRAILER='%%Trailer'

SETUP=HardcopySetup
DONE='(%stdout)(w) file -1 write'

while (! ~ $#* 0 && ~ $1 -*) {
	switch ($1) {
	case -c;  shift; OPTIONS=$OPTIONS' /#copies '$1' store'
	case -c*; OPTIONS=$OPTIONS' /#copies `{echo $1 | sed s/-c//}' store'

	case -f;  shift; OPTIONS=$OPTIONS' /font '/$1' def'
	case -f*; OPTIONS=$OPTIONS' /font '/`{echo $1 | sed s/-f//}' def'

	case -p;  shift; MODE=$1
	case -p*; MODE=`{echo $1 | sed s/-p//}

	case -m;  shift; OPTIONS=$OPTIONS' /magnification '$1' def'
	case -m*; OPTIONS=$OPTIONS' /magnification '`{echo $1 | sed s/-m//}' def'

	case -s;  shift; OPTIONS=$OPTIONS' /pointsize '$1' def'
	case -s*; OPTIONS=$OPTIONS' /pointsize '`{echo $1 | sed s/-s//}' def'

	case -x;  shift; OPTIONS=$OPTIONS' /xoffset '$1' def'
	case -x*; OPTIONS=$OPTIONS' /xoffset '`{echo $1 | sed s/-x//}' def'

	case -y;  shift; OPTIONS=$OPTIONS' /yoffset '$1' def'
	case -y*; OPTIONS=$OPTIONS' /yoffset '`{echo $1 | sed s/-y//}' def'

	case -L;  shift; PROLOGUE=$1
	case -L*; PROLOGUE=`{echo $1 | sed s/-L//}

	case --;

	case -*;  echo '$0: illegal option $1' >&2; exit 1
	}
	shift
}

switch ($MODE) {
	case l*; OPTIONS=$OPTIONS' /landscape true def'
	case *;  OPTIONS=$OPTIONS' /landscape false def'
}

echo $NONCONFORMING
cat $PROLOGUE
echo $ENDPROLOG
echo $BEGINSETUP
echo $OPTIONS
echo $SETUP
echo $ENDSETUP

cat $*

echo $TRAILER
echo $DONE