BSD 3 development
[unix-history] / usr / lib / vsamples / vtroff
CommitLineData
ac888172
BJ
1#
2# This version of vtroff does not use vsort. It is suitable
3# for short (e.g. 1 page) outputs, but will waste paper on
4# longer outputs. It works better for 1 page outputs because
5# it avoids the many bugs in vsort.
6set flags=() noglob length=() fonts=() fontf=() macp=(/usr/lib/tmac/tmac.vcat)
7top:
8 if ($#argv > 0) then
9 switch ($argv[1])
10
11 case -l*:
12 set length = $argv[1]
13 shift argv
14 goto top
15
16 case -F:
17 if ($#argv < 2) then
18 echo -F takes following font name.
19 exit(1)
20 endif
21 set argv=(-1 $2.r -2 $2.i -3 $2.b $argv[3-])
22 goto top
23
24 case -1:
25 case -2:
26 case -3:
27 case -4:
28 if ($#argv < 2) then
29 echo $1 takes following font name.
30 exit(1)
31 endif
32 if (! -r /usr/lib/fontinfo/$2) then
33 if (! -r /usr/lib/fontinfo/$2.r) then
34 echo ${2}: font not found.
35 exit(1)
36 endif
37 set argv[2] = $2.r
38 endif
39 if ($#fonts == 0) then
40 set fontf=/usr/tmp/fnt$$
41 cp /dev/null $fontf
42 endif
43 @ fnum = 0 - $1
44 echo .nr p $fnum >> $fontf
45 cat /usr/lib/fontinfo/$2 >> $fontf
46 set fonts=($fonts $1 $2)
47 shift argv
48 shift argv
49 goto top
50
51 case -x:
52 set macp=()
53 shift argv
54 goto top
55
56 case -*:
57 set flags = ($flags $argv[1])
58 shift argv
59 goto top
60
61 endsw
62 endif
63if ($#argv == 0) then
64 set argv=(-)
65endif
66/usr/ucb/troff -t $flags $macp $fontf $* | \
67 /usr/ucb/vpr -t $fonts
68if ($#fontf) then
69 rm $fontf
70endif